[Solved] Passing a value from Dynamic Select

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

[Solved] Passing a value from Dynamic Select

Post 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
Last edited by Addos on Thu Aug 18, 2005 4:57 pm, edited 1 time in total.
korto
Forum Commoner
Posts: 36
Joined: Thu Aug 18, 2005 6:30 am
Location: Greece
Contact:

Post 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?
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

Post 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
Post Reply