Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing html attribute value to the next script in php
    primarykey
    data
    text
    <p>I have three php scripts. main.php questions.php and values.php</p> <p>Here's the code</p> <p><strong>main.php</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Be Prepare for the battle&lt;/h1&gt; &lt;?php $strTitle = "Begin"; $strLink = "&lt;a href = 'question.php?ques_id=1'&gt;" . $strTitle ."&lt;/a&gt;"; echo $strLink; ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>questions.php</strong></p> <pre><code>&lt;?php require_once('../connect.php'); $quesSQL = mysql_query("SELECT * FROM `questions` WHERE `ques_id`=". $_GET["ques_id"]); if(!mysql_num_rows($quesSQL) &gt;= 1) { die('Complete.'); } $next = $_GET["ques_id"]; while($row = mysql_fetch_array($quesSQL)) { $id = $row['ques_id']; $strTitle = $row['ques_title']; echo "&lt;li&gt;" . $strTitle . "&lt;/li&gt;&lt;br/&gt;"; } $optSQL = mysql_query("SELECT `options`,`values` FROM questions_options WHERE " . $id . "= ques_id"); echo "&lt;form action=\"values.php\" method=\"POST\"&gt;"; while($row = mysql_fetch_array($optSQL) ) { $strOptions = $row['options']; $strValues = $row['values']; echo "&lt;input type =\"radio\" name =\"valueIn\" value=" . $strValues . " /&gt;" . $strOptions . "&lt;br/&gt;"; } echo "&lt;/form&gt;"; $strTitle = "&lt;input type =\"submit\" value=\"Next\"&gt;"; $next = $next + 1; $strLink = "&lt;a href = 'values.php?ques_id=" . $next . "'&gt;" . $strTitle ."&lt;/a&gt;"; echo $strLink; mysql_close(); ?&gt; </code></pre> <p><strong>values.php</strong></p> <pre><code>&lt;?php require_once('../connect.php'); $input = $_POST['valueIn']; $ansSQL = mysql_query("SELECT `answer` FROM questions WHERE 1-".$_GET["ques_id"]."= ques_id"); $marks = 0; if($input == $ansSQL) { $marks = $marks+1; } else { $marks = $marks+0; } echo $marks; ?&gt; </code></pre> <p>Now problem is i have to pass one value from second script(questions.php) to third script(values.php). And it is from the &#60;form&#62; section in radio button's name value "<em>valueIn</em>". But I can't do that. Because I'm sending another value ques_id with $strLink variable at the end of the second script. So how can i do that? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload