hello all,

I am having a form which contains a dropdown listbox
and a submit button. The user will choose any number
from 1 to 5 and hits the submit button. After this the
data that he had selected (1,2,3,4 or 5) enters into a
mysql database(this data enters into the row with the
latest userid) and a link appears, so that by click
that link he can go to next page.
I want to avoid the user from submitting his opinion
once again if he does it already.
Here is the code that i have wrote, which is going
logically some where wrong.
FYI : opinion and submit are the names of the dropdown
listbox and submit buttons. scene1 is the name of the
field in the table named testtable into which the data
enters(one of 1 to 5)

mysql_connect ('localhost','myname','password') or die
('<b>unable to connect to the database.</b>');
mysql_select_db ('usertest') or die ('<b>unable to
select the database.</b>');

if ($submit) {
$result = mysql_query("select * from testtable order
by userid desc limit 1");
$myrow = mysql_fetch_array ($result);
$id = $myrow["userid"];
$query = "update testtable set scene1='$opinion' where
userid=$id";
mysql_query ($query);
echo "<a href=next.php>Go to next page</a>";
/* this is the part i am trying to use to avoid him
from doing submission second time */
$result=mysql_query("select * from testtable order by
userid desc limit 1");
$myrow = mysql_fetch_array ($result);
$scene1 = $myrow["scene1"];
if ($scene1 == 1||2||3||4||5) {
echo "<script language=\"javascript\">";
echo "alert(\"You can choose the rating only
once\");";
echo "</script>";
}
}

Thanks
Chakravarthy K Sannedhi

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to