Jump to content

submit value by select box trouble


OldWest

Recommended Posts

i can't seem to see what my problem is.. i am "blind" to this bug as everything i am doing looks fine, so any advice please. i cannot get $company_id to insert a value to the table. NO errors are showing and all other data is being inserted as expected.

 

Submission page (all other data is going into the table as expected.)

$sql = "SELECT id, company_name FROM $table_name ORDER BY company_name";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query))
{
  echo "<option value=\"".$row['id']."\">".$row['company_name']."</option>\n";
}

 

Processing page snippet:

 

$company_id = $_POST['company_id']; // select box company_id value

 

$sql = "INSERT INTO $table_name (id, company_id, plan_name, plan_type, plan_details, plan_exclusions, plan_additional_info) VALUES ('','$company_id','$plan_name','','','','')";

 

Link to comment
https://forums.phpfreaks.com/topic/221258-submit-value-by-select-box-trouble/
Share on other sites

echo the SQL, what's it look like?

 

Blank value. It's not being passed from the form it appears, but that's what I can't get my finger on.

 

I should clarify, it's being passed as 0 (but 0 does not exist as an id in the company table).. I believe it is 0 because i defined it as int as a test: $company_id = (int)$_POST['company_id'];

 

No value is coming through at all from the form. I check all spelling etc. And I am guessing there is something I cannot see.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.