I am trying to insert my form's data radio buttons into my mysql database. it works very well but when i skip any one value of my radio button,as this is more than 20, its giving error that

Notice: Undefined index: qr1 in C:\wamp\www\exam\contents\omr.php on line 134
Call Stack
#   Time    Memory  Function    Location
1   0.0018  148808  {main}( )   ..\omr.php:0

but in the database, i am getting my desired result, means all the values are got inserted and which radio button is not put in the form, inseting with blank, as i want.. and also executing lines which is written after mysql query in the program.
so how can i debug my error??
hope you got my problem..plss anyone help me.

Recommended Answers

you will need to post all of your code. But it sounds like the problem is after your code to insert into the database. Id start there.

Jump to Post

ill see if i can help.

Jump to Post

All 5 Replies

you will need to post all of your code. But it sounds like the problem is after your code to insert into the database. Id start there.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body bgcolor="green">
    // Connects to your Database 

    //checks cookies to make sure they are logged in 
        $username = $_COOKIE['ID_my_site']; 
        $pass = $_COOKIE['Key_my_site']; 
        $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); 
        while($info = mysql_fetch_array( $check ))   
             //if the cookie has the wrong password, they are taken to the login page 
            if ($pass != $info['password']) 
                header("Location: login.php"); 


<form name="input" action="" method="post">
User Name: <input type="text" name="roll" value="" /><br />
<br />
<input type="radio" name="qr1" value="a">
<input type="radio" name="qr1" value="b">
<input type="radio" name="qr1" value="c">
<input type="radio" name="qr1" value="d">
<input type="radio" name="qr1" value="e">
<br />
<input type="radio" name="qr2" value="a">
<input type="radio" name="qr2" value="b">
<input type="radio" name="qr2" value="c">
<input type="radio" name="qr2" value="d">
<input type="radio" name="qr2" value="e">
<br />
<input type="radio" name="qr3" value="a">
<input type="radio" name="qr3" value="b">
<input type="radio" name="qr3" value="c">
<input type="radio" name="qr3" value="d">
<input type="radio" name="qr3" value="e">
<br />
<input type="radio" name="qr4" value="a">
<input type="radio" name="qr4" value="b">
<input type="radio" name="qr4" value="c">
<input type="radio" name="qr4" value="d">
<input type="radio" name="qr4" value="e">
<br />
<input type="radio" name="qr5" value="a">
<input type="radio" name="qr5" value="b">
<input type="radio" name="qr5" value="c">
<input type="radio" name="qr5" value="d">
<input type="radio" name="qr5" value="e">
<br />

    till qr50......

<input type="submit" name="submit" value="Submit">

                 if (isset($_POST['submit']))
                    $insert = "INSERT INTO omr (roll, qr1, qr2, qr3, qr4, qr5)
                               VALUES('".$_POST['roll']."', '".$_POST['qr1']."', '".$_POST['qr2']."', '".$_POST['qr3']."',
                               '".$_POST['qr4']."', '".$_POST['qr5']."')";
                    echo "Your answers is submitted now";       
     //if the cookie does not exist, they are taken to the login screen 
        header("Location: login.php"); 

this is all my code..now plss help me..

ill see if i can help.

hey guys please help me..my project work is goining in pending just because of thi s error...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.