0

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.

3
Contributors
5
Replies
25
Views
4 Years
Discussion Span
Last Post by manishp5
0

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.

Edited by leviathan185

0
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>rightframe</title>
</head>
<body bgcolor="green">
<?php 
    // Connects to your Database 
    require_once("connection.php");

    //checks cookies to make sure they are logged in 
    if(isset($_COOKIE['ID_my_site'])) 
    { 
        $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"); 
            } 
             else 
            { 

?>

<form name="input" action="" method="post">
User Name: <input type="text" name="roll" value="" /><br />
Reasoning
<br />
QR01.
<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 />
QR02.
<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 />
QR03.
<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 />
QR04.
<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 />
QR05.
<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">
</form> 

<?php
                 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']."')";
                    mysql_query($insert);
                    echo "Your answers is submitted now";       
                 } 
            } 
        } 
     } 
     else 
     //if the cookie does not exist, they are taken to the login screen 
     {           
        header("Location: login.php"); 
     } 
?> 
</body>
</html>
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.