kekagiso
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by kekagiso
-
-
[!--quoteo(post=351128:date=Mar 3 2006, 12:04 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Mar 3 2006, 12:04 AM) [snapback]351128[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You need to enclose your <select> fields in a form and POST it to another script to process (or POST it back to itself and do it all in the same script). Are you familiar with HTML forms?
[/quote]
I'm new to both HTML and PHP. I've spend the whole of yesterday searching for a solution. I'l be glad if you can assist. I know I'm left with that part that allows me to retrieve the selected value.
Thank you in advance -
I want to get the selected value from my combo box and save in mysql database. I dont even no how to begin, I've managed to create the combo box. Here is my code:
<?
include("dbinfo.inc.php");
class ComboBox
{
var $tableName;
var $databaseName;
/* Begin Edit Constructor */
function ComboBox( $tblname, $dbname )
{
$tableName = $tblname;
$database = $dbname;
/* Connect to database */
mysql_connect('127.0.0.1',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$para_query=mysql_query("select * from $tableName") or die(mysql_error());
/* Begin result table */
echo("<table width=100>");
echo("<select size=\"1\" name=\"id\">");
while ($row = mysql_fetch_array($para_query))
{
/* Output combo box */
echo("<option value=");
echo( $row[ 0 ] );
echo(">");
echo( $row[ 0 ] );
echo("</option>");
}
echo("</select>");
echo("</table>");
}// End Constructor
}// End Edit
?>
retrieving combo box value
in PHP Coding Help
Posted
[code]//HTML Form
<form name='data_collect' action='process.php' method='POST'>
Pick a number:
<select name='number'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
<input type='submit' name='submit' value='Go!'/>
</form>
//PHP Processing script
<?php
$number = $_POST['number'];
echo "The number you selected was: $number";
?>[/code]
[/quote]
Thanx a lot. I will try to modify my script using this one as a guide. My list box is a dynamic one as you might have seen.