Porko Posted February 18, 2009 Share Posted February 18, 2009 Hello 1st time poster, these forums look great and full of information Iam already absorbing . Iam still a newbie to PH but trying my best. Recently I have encountered a problem with my voting script it actually 2 problem though I will bother you with only one at the moment. As the topic says i keep getting this error when users submit voting without choosing vote option , I know i can just @the line but I would like if my code is clean of errors , here is the code: its line 5 - $rone=$_POST['rone']; <?php ob_start(); @$todo=$_POST['todo']; if(isset($todo) and $todo=="submit-rating"){ $rone=$_POST['rone']; $msg=""; $status="OK"; if(!isset($rone)){$msg=$msg."Please give your score and then click the button"; $status="NOT OK"; } if ($status=="OK") { $result=mysql_query("SELECT rating,votes FROM dd_1 WHERE dd_1.id= $id"); $rows=mysql_num_rows($result); $row=mysql_fetch_object($result); include("includes/config.php"); if($rows==0){ $query = "INSERT INTO $db_table (id, rating, votes) VALUES ('$id','$rating', '$votes') "; $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); include("responses/ok.php"); exit(); $off_to = "Location:". $ret_url; // back to the page we posted on header($off_to); ob_end_flush(); } else { $rating=$row->rating; $nov=$row->votes + 1; $status="OK"; $rating=$rating+$rone; $result=mysql_query("update dd_1 set rating=$rating,votes=$votes where id =$id"); include("responses/post-ok.php"); exit(); ob_end_flush(); } } } ?> Quote Link to comment Share on other sites More sharing options...
mike12255 Posted February 18, 2009 Share Posted February 18, 2009 your vote button links to that file? if so may we see the php code that the vote button is in? Quote Link to comment Share on other sites More sharing options...
Porko Posted February 18, 2009 Author Share Posted February 18, 2009 <?php echo "<TABLE width=120> "; echo "<form name=f1 action='' method=post>"; echo "<input type=hidden name=todo value='submit-rating'>"; echo "<tr><td ><INPUT TYPE=RADIO NAME=rone Value=1 onClick='f1()';><img src=images/star.gif></td></tr>"; echo "<tr><td><INPUT TYPE=RADIO NAME=rone Value=2 onClick='f1()';><img src=images/star.gif><img src=images/star.gif></td></tr>"; echo "<tr><td ><INPUT TYPE=RADIO NAME=rone Value=3 onClick='f1()';><img src=images/star.gif><img src=images/star.gif><img src=images/star.gif></td></tr>"; echo "<tr><td ><INPUT TYPE=RADIO NAME=rone Value=4 onClick='f1()';>"; echo "<img src=images/star.gif><img src=images/star.gif><img src=images/star.gif><img src=images/star.gif></td></tr>"; echo "<tr><td ><INPUT TYPE=RADIO NAME=rone Value=5 onClick='f1()';><img src=images/star.gif><img src=images/star.gif><img src=images/star.gif><img src=images/star.gif><img src=images/star.gif></td></tr>"; echo "<tr><td> <INPUT TYPE=SUBMIT value=Vote NAME=Vote>"; echo" </td> </tr></form></table></center>" ; ?> This is the file with the voting form. Quote Link to comment Share on other sites More sharing options...
Porko Posted February 18, 2009 Author Share Posted February 18, 2009 Any help please? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.