Jump to content

how to redirect to a jquery tab (after submitting data in that specific tab)


Kunkka

Recommended Posts

i want to redirect the page after submitting to the exact page with the tabs. but when i submit it just loads the same page. but what i want is it should load under the home tabs.

 

my other pages are loading in the div tags which are loaded using the Jquery tab

 

here is my code. please help me

 

<?php

session_start();

require($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
    $connection= mysql_connect($db_host,$db_user,$db_password) or die("Error Connecting");
       
    mysql_select_db($db_name,$connection);
   
  if(isset($_POST['submit']))
// check if the form is submitted, you should do this more carefully though
{

   
   
   
if(isset($_POST['question']))
    {$question = $_POST['question'];}
else
    {die("Please Type Question");}
   
if(isset($_POST['ans1']))
    {$answer1 = $_POST['ans1'];}
else
    {die("Please Type The 1st Answer");}
   
if(isset($_POST['ans2']))
    {$answer2 = $_POST['ans2'];}
else
    {die("Please Type The 2nd Answer");}
   
if(isset($_POST['ans3']))
    {$answer3 = $_POST['ans3'];}
else
    {die("Please Type The 3rd Answer");}
   
if(isset($_POST['ans4']))
    {$answer4 = $_POST['ans4'];}
else
    {die("Please Type The 4th Answer");}
   
if(isset($_POST['rdbRealAns']))
    {$correctanswer = $_POST['rdbRealAns'];}
else
    {die("Please Type The Correct Answer");}
   
   

   
    $query="INSERT INTO mcqpaper (Question,1stAnswer,2ndAnswer,3rdAnswer,4thAnswer,CorrectAnswer) VALUES ('$question','$answer1','$answer2','$answer3','$answer4','$correctanswer')";
   
    mysql_query($query,$connection) or die (mysql_error());
   
         [b]   echo '<script type=""text/javascript"">location.replace("home.php")</script>';
            echo "<script type='text/javascript'>$('#main-side-content').tabs( 'select' , 4 )</script>";
            [/b][color=#000066]
    }
   
    ?>

<html>
<head>

<title>MCQ Exam</title>
<link href="css/stylemaster.css" rel="stylesheet" type="text/css" />
<style type="text/css" media="all">
@import "css/stylemaster.css";.style1 {
    font-size: 18px;
    font-family: "Trebuchet MS";
}
body {
    background-color: #FFFFFF;
}

</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
h6 {
    font-size: 9px;
    color: #000;
}
-->
</style></head>

<body>
<div id="page-container">
   <div id="header" class="hidden"><h1> </h1>
   </div>
        <div id="main-nav" class="hidden">Main Nav</div>
   
         
</div> <div id="mcqpapercreate">

  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" >
         
       <table width="500" border="0" cellspacing="9" cellpadding="7">
  <tr>
    <td>Subject Name</td>
    <td> <select title="Subjectname" name="subname" id="classID">
    <?php
    $results="SELECT Class_ID,Class_Name FROM class WHERE Lec_ID=" . $_SESSION['LectID'];
    $query=mysql_query($results,$connection) or die(mysql_error());
   
    while($classdetails = mysql_fetch_array($query,MYSQL_NUM))
    {
        echo('<option value="' .$classdetails[0] . '">' . $classdetails[1] . '</option>');
    }
   
    ?>
    </select></td>
  </tr>

</table>
  <h3>Enter The Question</h3>
  <table width="700" border="0" cellpadding="2" cellspacing="1">
    <tr>
      <th><h6> </h6></th>
      <td width="451"><input name="question" type="text" id="text1" size="55"></td>
    </tr>
    <p><h6>Enter the Answers</h6></p>
    <tr>
      <td>01. </td>
      <td><input name="ans1" type="text" id="text" size="55"></td>
      <td width="23"><input type="radio" name="rdbRealAns" value="1" id="rdbRealAns_0"></td>
      <td width="125"><h6>Correct Answer</h6></td>
    </tr>
    <tr>
      <td>02. </td>
      <td><input name="ans2" type="text" id="text3" size="55"></td>
      <td><input type="radio" name="rdbRealAns" value="2" id="rdbRealAns_1"></td>
      <td><h6>Correct Answer</h6></td>
    </tr>
    <tr>
      <td>03. </td>
      <td><input name="ans3" type="text" id="text5" size="55"></td>
      <td><input type="radio" name="rdbRealAns" value="3" id="rdbRealAns_2"></td>
      <td><h6>Correct Answer</h6></td>
    </tr>
    <tr>
      <td>04. </td>
      <td><input name="ans4" type="text" id="text4" size="55"></td>
      <td><input type="radio" name="rdbRealAns" value="4" id="rdbRealAns_3"></td>
      <td><h6>Correct Answer</h6></td>
    </tr>
  </table>
  <br>
    <table width="300" cellpadding="0" border="0" cellspacing="0">
    <tr>
    <td align="right"><input type="submit" name="reset" id="reset" value="Reset"> </td>
    <td align="right"> <input type="submit" name="submit" id="submit" value="Submit"></td>
     </tr>
                         
  </form>
</div>
         
</body>
</html>

 

i have tried like that( i have bold it.. please refer the bold section).

 

my home tabs are like this

 

<script type="text/javascript">
          $(document).ready(function()
          {
          $('#main-side-content').tabs();
         
          });
  </script>

 

 

<div id="main-side-content">
    <ul>
      <li><a href="finalhome.php">Home</a></li>
      <li><a href="class.php" >Create A Class</a></li>
      <li><a href="studentregister.php">Register Students</a></li>
      <li><a href="mcqpaper_details.php">MCQ Paper Setting</a></li>
      <li><a href="mcq_paper.php">Create Paper</a></li>
    </ul>
   
  </div>

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.