|
Posted by Kimmo Laine on 01/26/06 09:21
"snowsong1" <snowsong1@gmail.com> wrote in message
news:1138258275.698887.317800@g47g2000cwa.googlegroups.com...
> Thank you very much for the help, NC.
> It has helped me a long quite a bit, as I now see the house names
> populating the drop-down list.
>
> The only problem i have is that I need a password blank below it to
> submit passwords, and everything I have tried to combine my previous pw
> blank with this drop down list doesn't work.
> Sorry, I'm a php novice in way over my head.
> Could you please tell me how to add a pw blank? I have attached my
> code below if it helps, with what you helped me do inserted.
>
> Thank you very much,
>
> Sincerely,
>
> Jamie
>
>
< hell of a lot code snipped >
> <! THIS STUFF IS WHAT I USED BEFORE. I was able to log in by typing
> user names and passwords manually -->
> <! Now I would like to be able to combine the password blank below
> (drop the House Name blank, of course) -->
> <form action="gk_login.php" method="post">
> <p>Greek House Name: <input type="text" name="house" size="20"
> maxlength="40" /> </p>
> <p>Greek Password: <input type="password" name="greek_password"
> size="20" maxlength="20" /></p>
> <p><input type="submit" name="submit" value="Login" /></p>
> <input type="hidden" name="submitted" value="TRUE" />
> </form>
>
The dropdown box must be within the range of the form to be included. In
other words, the drop down box needs to be created between the <form ...>
.... </form> tags to take effect. Try changing the order in your code to
this:
<!-- first start the form -->
<! THIS STUFF IS WHAT I USED BEFORE. I was able to log in by typing
user names and passwords manually -->
<! Now I would like to be able to combine the password blank below
(drop the House Name blank, of course) -->
<form action="gk_login.php" method="post">
<!-- now put in the drop down -->
<?php
// Create the form.
require_once ('./lcr_folder/mysql_connect.php');
// Performing SQL query
$result = mysql_query('SELECT house FROM greeks')
or die('Query failed: ' . mysql_error());
// Printing results in HTML
// REMOVE the extra <form> from here!!! You only need one
echo "\r\n<select name=house>\r\n";
while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
$house = $line[0];
echo "<option value=$house>$house\r\n";
}
echo "</select>\r\n <input type=submit value=Send>\r\n\r\n";
// Also REMOVE the extra </form> from here
?>
<!-- And then the rest of your form fields -->
<p>Greek House Name: <input type="text" name="house" size="20"
maxlength="40" /> </p>
<p>Greek Password: <input type="password" name="greek_password"
size="20" maxlength="20" /></p>
<p><input type="submit" name="submit" value="Login" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</form>
<!-- And that's it! -->
The problem was that you had the drop down box in a different form than the
password field. <form><select...></form><form><password...></form> doesn't
work, they both need to be in the same form in order to be submitted in the
same request. When submit is clicked only those fields which are within it's
<form></form> get submitted
--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|