Hello,
This is what I am trying to accomplish:
There are two drop down menus, one that specifies the record id, and than the information in that row (specified by record_id). I would like the currently stored data to display in the text fields, and than they can be edited and updated.
Here's the problem i am having, the form under an if statement inside the second case (case entry1) does not update the record in the database.
P.S. Thank you, i appreciate your help! - Also, please excuse the poorly developed script, i am a newbie! Thanks
Jeff
<?php
//connection info
print "
<br>
<form action=\"$query_select_record\" method=\"POST\">
Select Record ID:
<select name=\"record_id\">
<option value=\"Select Record\">Select</option>";
$query_select_record = mysql_query( "SELECT symbol FROM market_research" );
while ( $a_row = mysql_fetch_array( $query_select_record ) )
{
print "<option value=\"$a_row[symbol]\">$a_row[symbol]</option>";
}
print "</select><br>
<br>Select Info To View
<select name=\"select_info\">
<option value=\"Select\">Select</option>
<option value=\"general\">General Info.</option>
<option value=\"entry1\">Day 1 (Monday)</option>
</select>
<input type=\"submit\" value=\"Display Record\" class=\"pushbutton\"></form>";
switch ( $select_info )
{
case "general":
$query_general = mysql_query( "SELECT * FROM market_research WHERE symbol = '$record_id'" );
if ( $a_row = mysql_fetch_array( $query_general ) )
{
print "
Symbol<input type=\"text\" value=\"$a_row[symbol]\"><br>";
}
else
{
print "ERROR";
}
break;
case "entry1":
$query_entry1 = mysql_query( "SELECT * FROM market_research WHERE symbol = '$record_id'" );
if ( $a_row = mysql_fetch_array( $query_entry1 ) )
{
print "
<form action=\"$query_update\" method=\"POST\">
Prev Day Close
<input type=\"text\" name=\"input\">
<input type=\"submit\" value=\"Update Record\" class=\"pushbutton\"></form>";
$query_update = mysql_query( "UPDATE market_research SET day1_prev_close = '$input' WHERE symbol = '$record_id'" );
if ( $query_update )
{print "successfuly added theinfo";}
else {print "error adding the info";}
}
else
{
print "ERROR";
}
break;
default:
print "Please Select An Entry To View";
}
mysql_close( $link );
include "page_bottom.php";
?>