Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When I Insert a new Entry into My Database the variable is a String

Status
Not open for further replies.

banty19

Programmer
Mar 13, 2005
2
US
Hello,

For some reason when I try to submit the values of variables the string appearence of the variable is shown instead of its actual contents. For instance,

-region1_g1's value is determined by a drop down menu (in this case, it is #1)
-i then create the variable $region1_g1 by using $region1_g1=$HTTP_POST_VARS['region1_g1'];
-i then add slashes for the database entry by using $region1_g1 = addslashes($region1_g1);

I have no problem connecting with the database. But everytime I input $region_g1 the database entry is $region_g1 instead of its value, which is #1. The variable is specified as a VARCHAR(20) in the SQL database. Here is what my insert code looks like.

$query = 'INSERT INTO `Picks` ( `firstn` , `lastn` , `id` , `region1_g1`, etc etc) VALUES ( '$nc' , '$nc' , \'33\',
'$region1_g1', etc etc)'

There are more fields but I omitted them due to space. I have a feeling that I'm missing something very easy and if anyone could help it would be greatly appreciated.
 
can you post the form creation code. i suspect the error is that you are not expressly declaring *all* the select option values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top