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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.