Jump to content

Recommended Posts

Hi guys,

 

i have a problem regarding the naming of a text box. I am trying to create a php page that brings back a list of questions in my database table --> (qid (pk), question, active), only if active is marked as YES. The questions are displayed on the screen using a while loop because there are an unknown amount that could come from the DB. Each question should have a textbox with it, which allows the user to enter the answer. When then user is happy with the answer it should then take the data from the textbox and the qid of the question and insert it into a another table.

 

I can do this fine if the amount of questions are static, but because the amount can vary i cant work out how to pick up the data, and i dont know what each text box will be called.

 

i have currently got the following while loop:

 

<?php while($rowactivequestions=mysql_fetch_array ($resultactivequestions))

{

echo $rowactivequestions['question'];

?>

<br />

<textarea name='answer' rows="5" cols="70">Answer.</textarea>

<br />

<br />

<?php } ?>

 

Is there any way that i can give the text box a dynamic number and also be able to pick the textbox name up, the question number (qid), and also the text the user enters, and post this to a script that inserts it into the database?

 

Any ideas would be gratefully received!!!

 

Thanks!!!

Link to comment
https://forums.phpfreaks.com/topic/89396-database-dilemma/
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.