Jump to content

Input box not registering value


Tuk

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.