combobox [message #177312] |
Wed, 07 March 2012 21:15 |
ecu_jon
Messages: 3 Registered: March 2012
Karma:
|
Junior Member |
|
|
i am trying to make a combo box, choose from a list or type in new. i
lifted code from another page i did that had the drop-down list, and
tried to add it to several text boxes. it is not pushing the choice
choosen from the drop-down on to the nextpage/sql. frustraded, i
didn't do much more then copy pasta from the other page, just massaged
it a little to fit in, just does not work. have excluded the fluff
html surrounding this, just imagine basic html,head,body tags.
<?php
$host="localhost"; // Host name
$username="name"; // Mysql username
$password="pword"; // Mysql password
$db_name="name"; // Database name
$tbl_name="othername"; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot
connect");
mysql_select_db("$db_name")or die("cannot select DB");
$result = mysql_query("SELECT DISTINCT client FROM client ORDER BY
client ASC") or die(mysql_error());
echo '<form action="./page5.php" method="post"><pre>';
echo 'Client ';
echo '<select name="option">';
while($row= mysql_fetch_array($result)){
echo "<option value=\"$row[client]\">$row[client]</option>\n";}
mysql_close();
echo '</select>';
echo '<input type="text" maxlength="70" name="Client"><br />';
echo 'Site <input type="text" maxlength="70"
name="Site"><br />';
echo 'First,Last Name <input type="text" maxlength="20"
name="Uname"><br />';
echo 'User ID <input type="text" maxlength="20"
name="Uid"><br />';
echo 'Password <input type="text" maxlength="20"
name="Password"><br />';
echo 'Status <input type="text" maxlength="20"
name="Status"><br />';
echo '<input type="submit" value="submit" name="submit"><br />';
echo '</pre></form>';
if(isset($_POST['Client'])) $Client = $_POST['Client'];
if(isset($_POST["Site"])) $Site = $_POST["Site"];
if(isset($_POST["Uname"])) $Uname = $_POST["Uname"];
if(isset($_POST["Uid"])) $Uid = $_POST["Uid"];
if(isset($_POST["Password"])) $Password = $_POST["Password"];
?>
|
|
|