Member Avatar for anmol.raghuvanshi1

hello every one i am creating form of 15 question length for 5 questions it worked but when i increase the length of question to 15 or 18 dont work plz help me it's urgent

<?php
    //Start session
    session_start();

    //Include database connection details
    require_once('connection/config.php');

    //Array to store validation errors
    //$errmsg_arr = array();

    //Validation error flag
    //$errflag = false;

    //Connect to mysql server
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    if(!$link) {
        echo"Not Connected";
        die('Failed to connect to server: ' . mysql_error());
    }

    //Select database
    $db = mysql_select_db(DB_DATABASE);
    if(!$db) {
        echo "Not Selected";
        die("Unable to select database");
    }

    //Function to sanitize values received from the form. Prevents SQL injection
    function clean($str) {
        $str = @trim($str);
        if(get_magic_quotes_gpc()) {
            $str = stripslashes($str);
        }
        return mysql_real_escape_string($str);
    }

    //Sanitize the POST values
    //$ans = clean($_POST['25rboption13']);



    //If there are input validations, redirect back to the same form
    /*if($errflag) {
        $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
        session_write_close();
        header("location: .php");
        exit();
    }
    */

    //Check whether the query was successful or not
    /*$ignorefield=array('submit');
    $fields=array_intersect($_POST,array_flip($ignorefield));
    $values=array();
    */  
    if(isset($_POST['submit'])){

                            $ans=isset($_POST['25rboption13']);
                                $ans=isset($_POST['129rboption13']);
                                    $ans=isset($_POST['150rboption13']);
                                        $ans=isset($_POST['151rboption13']);
                                            $ans=isset($_POST['152rboption13']);
                                                $ans=isset($_POST['153rboption13']);
                                                    $ans=isset($_POST['154rboption13']);
                                                $ans=isset($_POST['592rboption13']);
                                            $ans=isset($_POST['593rboption13']);
                                        $ans=isset($_POST['594rboption13']);
                                    $ans=isset($_POST['595rboption13']);
                                $ans=isset($_POST['596rboption13']);
                            $ans=isset($_POST['1169rboption13']);






    //  foreach($_POST as $ans){
        if($ans!=""){
        //Create query
        $qry="INSERT INTO diseases (q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,q13) values(' ".$_POST['25rboption13']." ',' ".$_POST['129rboption13']." ',' ".$_POST['150rboption13']." ',' ".$_POST['151rboption13']." ',' ".$_POST['152rboption13']." ',' ".$_POST['153rboption13']." ',' ".$_POST['154rboption13']." ',' ".$_POST['592rboption13']." ',' ".$_POST['593rboption13']." '' ".$_POST['594rboption13']." ',' ".$_POST['595rboption13']." ',' ".$_POST['596rboption13']." ',' ".$_POST['1169rboption13']." ')";
        $result=mysql_query($qry);}
        echo "data inserted";
        //}
            //Successful

        }else {
        die("Query failed");
    }
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Form Processing</title>
</head>

<body>
</body>
</html>



this my php code to process the form problem is here i cant make all radio buttons fall under same name??? 
Member Avatar for diafol

SHow your form

Be a part of the DaniWeb community

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