Jump to content

submit value by select box trouble


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

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

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

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.