Jump to content

[SOLVED] weird problem with passing a POST value


jeff5656

Recommended Posts

I am using the same bits of code from other files that work.

Basically I have this form:

<form name="newsubmit" method="post" action="commit.php"> 
[...]
<?php $some_array = array("a"=>"Active","s"=>"Remove");

$signoff_status = $row['signoff_status']; 
print("<select name='signoff_status'>");
foreach($some_array as $key => $some_value)
{
  print("<option value='$key' ");
  if($key == $signoff_status)
  {
   print(" selected");
  }
   print(">$some_value</option>\n");
  }
print("</select>\n");?> 

when I echo back $signoff_status it says "a" which is appropriate for that record.

but here is the file commit.php:

<?php
echo "signoff status is:" . $_POST['signoff_status'];

and I get "signoff status is:"

Huh? how did the POST become empty when the select part of the form had the correct value?  This is an EXACT pasted code snip from my other forms that do work.

FYI the field is ENUM and it is 'a','s'

Thanks!

What do you mean?  I didnt post the entire form thats like 100 lines.  The rest of the variables work.  Is there soemthing wrong with the above <select> part of the form?  I have a submit button etc.  Do you need me to upload the entire code?

Change

<select name='signoff_status'>
<option value='a'  selected>Active</option>
<option value='s' >Remove</option>
</select>

 

To this.. (I think)

 

<select name='signoff_status'>
<option value='a'  selected='selected'>Active</option>
<option value='s' >Remove</option>
</select>

 

It may or may not be making something not work.

selected='selected' is correct HTML, however just using selected works in at least FF (tested.)

 

The posted select menu, when contained in a valid form, submits an 'a' for $_POST['signoff_status']. Something about your form or your form processing code is causing nothing to be submitted. The only way you can get specific help with what is wrong is if you post your code.

I put the whole code in and then found out that the reason this didnt work is I had another part of the form that also had a <select> with the same name (signoff_status).  I guess cutting and pasting from my other code has it's dangers LOL.

Thanks to all...

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.