Jump to content

Notice: Undefined index: rone in,.... Help pls!


Porko

Recommended Posts

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 :P 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();
}	
}
}

?>

Link to comment
https://forums.phpfreaks.com/topic/145669-notice-undefined-index-rone-in-help-pls/
Share on other sites

<?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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.