Okay, so my post is actually about 1/3 PHP, but I've once again frittered away my whole evening Searching and RTFM so I'm asking anyway. TIA for help 🙂
Here's my form, after I've connected:
<form action="post">
<select>
<option>
//Query the Type field, which has Chrysanthemum, etc.
<?
mysql_select_db('MyDB');
$user_query = mysql_query("select
Type from tbl_flowers");
while ($row = mysql_fetch_array($user_query)) {
echo $row['Type'] . '<option>';
}
?>
</option>
</select>
//In theory, this is gathering what I can change the type to (not add new ones). For example, change Chrysanthemum to Lilac.
<input name="NewType"></input>
<input type="submit" name="submit" value="submit"></input>
</form>
<?
$update = mysql_query(
"update tbl_flowers set Type = \"Lilac\"")
or die('insert failed: ' . mysql_error() );
?>
Now granted, this does work. However, two things I can't seem to get to work:
1) $update = mysql_query("update tbl_flowers set Type = " . $_POST['Type'])
2) Okay, that was the PHP question. Related questions I've forgotten and can't seem to find the answer to on the Net:
When I do ~set Type = \"Lilac\" where RowID=1~ which is what I would want the user to be able to do instead of all values, it does change one value, but it's the last in the list of RowID's 1 through 4. Why?
When I click the Submit button, it takes me to this url: /.../post?NewType=mytext&submit=submit --> but it's a PageCBDisplayed. It does update the db in the meantime, however. What's up with that?
I think this post may be a better fit in the n00b category, but thanks for your help. 🙂
Chris