Jump to content

[SOLVED] PHP changing my form input?


djfox

Recommended Posts

I have this section of a form made:

<b>Gender:</b>
<br><select name="gender" style="border: 0px; background-color:#000000; color: #B6ABCE;">
<option value="b">Both
<option value="f">Female
<option value="m">Male
</select>

 

Here`s the php section that the results of all of the fields in the form are sent to:

	$add="INSERT INTO clothing ( name, desc2, shortname, store, files, layers, gender, posespec, type, cost, spec, date ) VALUES ( '$title', '$des', '$short', '$region', '$filenames', '$lay', '$gender', '$pose', '$type', '$price','$spe', '$entry_date' )";
$res = mysql_query($add) or die(mysql_error());

 

When the field entry for gender is supposed to be is "b". But when the form is filled out and sent, the gender entry "b" is somehow changed to "B", which causes complications for several other pages. The "gender" field in the database table was set to char type and thinking that was why, I tried changing it to varchar. But the mysql doesn`t want to change it to varchar.

 

What should I do to keep the letter lowercase?

Link to comment
Share on other sites

Try adding another field that has a varchar type.  Then write a quick sql statement that will copy whatever is in the char field to the varchar field.  Then delete the char field, and rename the varchar field to what the name the char field was.

Link to comment
Share on other sites

Now I`m worried. I set the new field gend to type varchar and the table immediately changed it to char and won`t let me change that type either.

 

My mistake, I did not realize that varchar needs a larger number than 2 for it`s lengths.

Link to comment
Share on other sites

Ok, I got gender set to varchar (hoping that it would leave the input alone and not capitalize anything). Now the form sends "Both" instead of "b". (First post shows that the value to be sent should be just "b".) Strange I`ve never had such a problem with forms before. =P

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.