Re: combobox [message #177313 is a reply to message #177312] |
Thu, 08 March 2012 06:28 |
Scott Johnson
Messages: 196 Registered: January 2012
Karma:
|
Senior Member |
|
|
On 3/7/2012 1:15 PM, ecu_jon wrote:
> 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"];
> ?>
It would be nice if you could at least put some effort and clean up this
code so it is a bit more readable since you are asking others to
decipher it.
So I will work backwards.
What code is on page5?
What do you get on page5 if you add
print_r($_POST);
|
|
|