Tuk Posted March 27, 2011 Share Posted March 27, 2011 I have a form where members on my site can update their display name among other things. However, my script is returning the error for if nothing was inputted in the display name input box (members must provide a display name, can't leave that box blank) even though my text input box definitely has a value. The section of my form with the input box: <tr> <td class='sidebardark' width=40%><b>Display Name</td> <td class='D' width=60%><input type=text name=newdisplayname class='inputtext' value="<? echo $currentname;?>"></td> </tr> And the section in my form-submitted script that has the error that's displaying: $newdisplay = strip_tags(mysql_real_escape_string($POST['newdisplayname'])); if ($newdisplay == "" || !isset($POST['newdisplayname'])){ errorbox("You must set a display name!"); } Normally I'd think it was a typo on my part but I honestly can't see anything wrong with it. The current display name is showing up just fine in the input box. I asked it to echo $newdisplay above the error box and it echoed nothing so I have to assume it's not passing the variable correctly for some reason. Edit: If it matters, I haven't had any issues with text input boxes on this particular site before. Only this specific one. Quote Link to comment https://forums.phpfreaks.com/topic/231871-input-box-not-registering-value/ Share on other sites More sharing options...
Tuk Posted March 27, 2011 Author Share Posted March 27, 2011 Any ideas at all? This is killing me, lol. Quote Link to comment https://forums.phpfreaks.com/topic/231871-input-box-not-registering-value/#findComment-1192942 Share on other sites More sharing options...
Pikachu2000 Posted March 27, 2011 Share Posted March 27, 2011 Don't bump threads without providing additional, relevant information. Now that we've gotten that out of the way, the typo is that $POST doesn't exist unless you've defined it yourself. The superglobal array is $_POST. Also, HTML tag attribute values need be quoted to be valid markup, BTW. Quote Link to comment https://forums.phpfreaks.com/topic/231871-input-box-not-registering-value/#findComment-1192950 Share on other sites More sharing options...
Tuk Posted March 27, 2011 Author Share Posted March 27, 2011 Thanks Pikachu2000, t'was a typo after all -- I didn't even notice I'd put $POST. Quote Link to comment https://forums.phpfreaks.com/topic/231871-input-box-not-registering-value/#findComment-1192953 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.