Jump to content

value not being POSTED to next page


woodplease

Recommended Posts

i have a form where i post values, and then retrieve them on another page, but only one of the values is being retrieved.

 

This is my post form

<?php
$id = $_GET['id'];
$query = "SELECT * FROM questions WHERE quizref = " .$id ;
$question = 'questionno';
$result2 = pg_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = pg_num_rows($result2);

?>

<form method="post" action ="editquestions.php">
<?PHP

for($i = 1; $i <= $numofrows; $i++) {
$row = pg_fetch_array($result2); //get a row from our result set

echo '<input type="hidden" name="quizno" value="'.$id.'">
	  <input type="hidden" name="questionno" id="'.$row['questionno'].'" value="'.$row['questionno'].'" >
<br/><p>Question '.$row['questionno'].': ' .$row['question'].' <input type="Submit"  id="'.$row['questionno'].'" value="EDIT">  <br/><br/></p>


 

and this is the code that retrieves it

$id = $_POST['quizno'];
$question = $_POST['questionno'];

echo 'The quiz number is:'.$id;
echo'<br/>The question number is:'.$question; 

 

It is only displaying the $id correctly,and it displays the $question as the total number of questions on the previous page, even though when you view the source, the value that is to be sent is thequestion number.

 

this is the link to the page that originally posts the information, and then when you click the edit button, it takes you to the page that is supposed to display that information

http://users.aber.ac.uk/agd8/quizdom/questionlist.php?id=1

Link to comment
https://forums.phpfreaks.com/topic/190665-value-not-being-posted-to-next-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.