Chris Harris <[EMAIL PROTECTED]> wrote:
Hi,
Just wondering if you could help me out with a problem I can't seem to
solve. I have a MYSQL/PHP photo gallery website which I'm currently
developing.
In order to add records I've created a page with an HTML form which
inserts records into the MYSQL database. I've had no problems
inserting data from text <INPUT> type fields. However, when I come to
add data from a <SELECT> drop down box, it isn't working. For some
reason - & regardless of the option picked when you submit the form -
the data entered is always the last value in the list.
Has anyone any ideas? Grateful for any tips/solutions. The relevent
code is below:
<?PHP
$query1 = "SELECT DISTINCT picplace FROM pictureplace ORDER BY picplace";
$result1 = mysql_query($query1)
or die ("Couldn't execute query1.");
?>
<form action='<?$PHP_SELF?>' method='post'>
<select name='picplace'>
<?
while ($row = mysql_fetch_array($result1))
{
extract($row);
echo "<option value='$picplace'>$picplace \n";
}
echo "</select> \n";
?>
<br />
<input type='submit' value='>' />
</form>
Thanks,
Chris
My select inputs look like this in the form:
<select id="StateResidence" name="StateResidence">
<?php include('http://????/options/states.txt'); ?>
</select>
then I get the value that was selected with this:
$StateResidence = $_POST['StateResidence'];
That should give you whatever value was selected in the form. Check the option
values that are printed out in the source code from the View menu|Page Source.
If you have the select showing correctly on the form and the option values set,
then you should be get whatever value was submitted.
hope this helps.
The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database
possibilities through group learning.
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/