sed57
New Member
Posts: 11
|
Post by sed57 on Nov 24, 2012 16:46:22 GMT -5
Not sure where else to post this, so gonna drop it here in the general.
My code is getting stuck and I cannot figure out what it is. Here is the code:
$sentUsername=$_POST['newusername']; $sentPassword=crypt($_POST['newpassword']); echo '1'; $sentFname=$_POST('newfname'); echo '2'; $sentLname=$_POST('newlname'); echo '3'; $sentEmail=$_POST('newemail');
The echo statements are there for my error checking to see where the problem is. It makes it to 1, but never makes it to 2. It just stops. Anyone have any idea what could be wrong. A var_dump($_POST); before this confirms that there are values in all of the necessary indexes from the form. I am just absolutely stumped as to why this doesn't work.
Thanks for any help. -Sean
|
|
|
Post by Bob P on Nov 25, 2012 22:19:58 GMT -5
I think this should work .... post your form too. Bob
|
|
sed57
New Member
Posts: 11
|
Post by sed57 on Nov 25, 2012 22:51:37 GMT -5
<form name="registerform" method="post" action="register.php"> <table width="20%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong><center>Register</center></strong></td> </tr> <tr> <td width="78">First Name</td> <td width="6">:</td> <td width="294"><input type="text" name="newfname" id="newfname"></td> </tr> <tr> <td>Last Name</td> <td>:</td> <td><input type="text" name="newlname" id="newlname"></td> </tr> <tr> <td>Email Address</td> <td>:</td> <td><input type="text" name="newemail" id="newemail"></td> </tr> <tr> <td>Desired Username</td> <td>:</td> <td><input name="newusername" type="text" id="newusername"></td> </tr> <tr> <td>Desired Password</td> <td>:</td> <td><input name="newpassword" type="text" id="newpassword"></td> </tr> <tr> <td></td> <td></td> <td><input type="submit" name="Register" value="Register"></td> </tr> </table> </form>
This is the form. I have been stumped on this because it does fine with the username and password, but then craps out at the first name, and everything seemed to be the same to me.
|
|
|
Post by Bob P on Nov 26, 2012 1:30:54 GMT -5
Here's the solution..... make sure you are sitting down.
This line works: $sentUsername=$_POST['newusername'];
This line doesn't: $sentFname=$_POST('newfname');
For some reason you started using parentheses instead of brackets around your form element names - ['newusername'] = good - ('newfname') = bad
Bob
|
|
sed57
New Member
Posts: 11
|
Post by sed57 on Nov 26, 2012 2:17:51 GMT -5
oh wow. I feel stupid now. Not sure why I switched to parentheses, must've been an accident after the crypt function. Thank you for pointing that out though. Sometimes you just need a second set of eyes to look at you code.
|
|