Jump to content

option value


An7hony

Recommended Posts

I'm having the strangest thing happing.

When posting a form i'm not getting the option value. Instead its posting my text field

 

ie: <option name="1">text</option>

 

<?php
$query  = "SELECT id, name FROM locations ORDER BY name";
$res = mysql_query($query, $cid);
while($a = mysql_fetch_array($res)) {
	echo "<option name=".$a["id"].">".$a["name"]."</option>";
}
			 ?>

 

<?php
The code thats grapping it:
if($_POST['location']==""){
   $location = "";
   echo '<div class="message error">Please enter a <strong>Location</strong></div>';
}else{
   $location = $_POST['location'];
}
?>

 

Can anyone see why? I have also tried it in html to see if its my php, but i get the same result

Link to comment
https://forums.phpfreaks.com/topic/232182-option-value/
Share on other sites

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.