Page 1 of 1

[Solved] Passing a value from Dynamic Select

Posted: Thu Aug 18, 2005 3:30 pm
by Addos
I’m looking for some help with this. If I want to insert a value from a form field I use

Code: Select all

$insertSQL = sprintf("INSERT INTO enquiries (property) VALUES (%s)",
                       GetSQLValueString($_POST['property'], "text"),
But I don’t know how to pass the same value from a dynamically created select box such as this and in effect replace GetSQLValueString($_POST['property'], "text"), .

Code: Select all

<?PHP echo "<select name='Property' id='Property'>\n
	  <option value=\"'%'\">Select</option>"; 
		while($dbRow = mysql_fetch_array($GetProperty)){ 
  		echo "<option value='"
		. $dbRow["properties_idpk"]  
		. "'>"
		. $dbRow["name"]
		."</option>\n"; 
		} echo "</select>\n"; 
		?>
If anybody can give me some idea how this is done I’d be most grateful.
Thanks a mil
B

Posted: Thu Aug 18, 2005 3:44 pm
by korto
If I have understood was it is asked I think that the way the value of a select box is passed is the same as with an input box. ($_POST['Property']). Are you getting some kind of an error?

Posted: Thu Aug 18, 2005 4:56 pm
by Addos
Thanks Korto,
I realised that it was a typo issue and I wasn't matching the case for example:

Code: Select all

"<select name='Property' id='Property'>
GetSQLValueString($_POST['property'], "text"),
The word property is P and p :oops:

Thanks
B