Problem with FORM, SELECT and SUBMIT - select value never shows up
| From: | Warrick Wilson \(Avignon Reg'd Kennels\) | Date: | Sat, 14 Jul 2001 20:48:00 +0000 |
| Subject: | Problem with FORM, SELECT and SUBMIT - select value never shows up | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-57903@lists.php.net to get a copy of this message | ||
I'm a new PHP/mySQL user (all of about 10 hours so far, working thru some
web-based tutorial stuff and using resources on the Internet). I have the
following "problem":
You can try the code out at
http://www.bond.net/~warrickw/zone6jrs/testsel.php
I want to have a form that lists values in a <SELECT> menu. Eventually I
will go back to populating the form from a database. I've been working
backwards and I am down to basic HTML and a little bit of PHP to look at the
submitted values.
The problem is my page NEVER, NOT EVER recognizes the value for the
myhandlerlist <SELECT> menu. If I submit by GET, it shows up in the URL
address, but isn't recognized. I added a second <SELECT>, and THAT got
recognized, and it recognizes my <INPUT> elements, but no way can I get a
value for the myhandlerlist.
I did some searching thru the archives and generally on the Internet, and
found lots of people posting similar sorts of problems, but the proposed
solutions I saw all dealt with building the lists dynamically. I moved away
from that to this single item list and I still can't figure out why it won't
work.
Any and all help appreciated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Selection</title>
</head>
<body>
<h1 align="center">Add/Update Handler Information</h1>
<p>On entry:</p>
<?php
// Just a test for onentry stuff
echo("<p>");
if (is_array($myhandlerlist)) {
echo("myhandlerlist is an array!\n\n");
}
echo("</p>");
echo("<p>");
if (isset($myhanderlist)) {
echo("myhandlerlist is set to " . $myhandlerlist );
} else {
echo("myhandlerlist is NOT set");
}
echo("</p>");
echo("<p>");
if (isset($list2)) {
echo("list2 is set to " . $list2 );
} else {
echo("list2 is NOT set");
}
echo("</p>");
echo("<p>");
if (isset($hupdate)) {
echo("hupdate is set to " . $hupdate );
} else {
echo("hupdate is NOT set");
}
echo("</p>");
echo("<p>");
if (isset($hadd)) {
echo("hadd is set to " . $hadd );
} else {
echo("hadd is NOT set");
}
echo("</p>");
echo("<p>");
if (isset($useraction)) {
echo("useraction is set to " . $useraction );
} else {
echo("useraction is NOT set");
}
echo("</p>");
?>
</p>
<p>Select a handler from the list and press <b>Update</b>, or press
<b>New</b> to add a new Handler.</p>
<!-- <form action="http://www.tipjar.com/cgi-bin/test"
method="post"
name="useraction" id="useraction"> -->
<form action="<?php echo("$PHP_SELF"); ?>" method="get"
name="useraction"
id="useraction">
<select name=myhandlerlist>
<option selected value="99">Warrick Wilson</option>
</select>
<br><br>
<input type="submit" name="hupdate" value="Update Selected
Handler">
<br><br>
<input type="submit" name="hadd" value="Add New Handler">
</body>
</html>
Warrick Wilson
Avignon Reg'd Kennels
Kitchener, Ontario, Canada
http://www.avignonkennels.com
mailto:warrickw@avignonkennels.com