Jump to content

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

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.