473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can I post an array for 'submit'?

2
Hi all,

I am writing a test system.I want to post question id and selected answer id(I used radiobuttons), when user clicks on the 'Submit' button.Also I want same for the 'Next' and 'Back' buttons.
I am not entirely sure that I did correct.Here is the code
Expand|Select|Wrap|Line Numbers
  1. .....
  2. {
  3. for ($i = 0; $i < count($query); $i++) {
  4.  
  5.                 $qid = $query[$i][0];               
  6.  
  7.                 echo $qid;
  8.                 $tanswer = "SELECT ans.id,ans.text FROM answers AS ans WHERE '$qid'= ans.qid  AND ans.correct= 'true' ORDER BY RAND() LIMIT 1";
  9.                 $fanswers="SELECT ans.id,ans.text FROM answers AS ans WHERE '$qid'=ans.qid AND ans.correct='false' ORDER BY RAND () LIMIT 3";
  10.                 $fa=GetResultTableSQL($fanswers);
  11.                 $ta=GetResultTableSQL($tanswer);
  12.                 echo"<tr>
  13.  
  14.                  <td>{$query[$i][1]}</td>
  15.                  </tr>";
  16.                 for($k=0;$k<count($fa);$k ++){
  17.  
  18.                  echo"<tr>
  19.                  <td><input='hidden' name='quizID' value='$quizID'></td></tr>
  20.                  <tr><td><input='hidden' name='qid' value='$qid'></td></tr>
  21.                  <tr><td><input='hidden' name='aid' value='{$fa[$k][0]}'></td></tr>
  22.                  <tr><td>{$fa[$k][1]}</td> <td><input type='radio' name='data[$qid][$aid]' value='{$fa[$k][0]}'></td>
  23.                  </tr>";
  24.                 }
  25.  
  26.                  echo"
  27.                  <td><input type='submit' name='n[$qid][$aid]' value='Next'></td>
  28.                  <td><input type='submit' name='b[$qid][$aid]' value='Back'>
  29.                  <td><input type='submit' name='s[$qid][$aid]' value='Submit'>
  30.                  </td><td>&nbsp;</td>";
  31.  
  32.                 }
  33.  
Thanks in advance
Feb 27 '11 #1
0 992

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Dave Smithz | last post by:
Hi there, I have a situation where I want to have multiple submit buttons on the same form and therefore want to use a redirection php script that checks the value associated with the submit...
0
by: Charlie Taylor | last post by:
I'm having trouble passing binary data back from a python CGI script when a POST is used to send FORM data to a Windows Server. In this case, I've used all of the "import msvcrt" approaches and...
6
by: brian_mckracken | last post by:
This might not be the right group for this question, since its kind of a pure html question... Given the html construct: <form action='index.php?expand=0,10000' method='post'> Email: <input...
5
by: Thejo | last post by:
Hi all, I started programming in PHP recently and have a query about empty $_POST arrays. I can see two scenarios when this could happen. 1. When some tries to directly load the page to which...
5
by: Chuck Anderson | last post by:
I have finally started coding with register_globals off (crowd roars - yeay!). This has created a situation that I am not sure how I should handle. I have scripts (pages) that can receive an...
1
by: wingsforwheels | last post by:
Prior to posting a form (.asp page) to a URL, I check the parameters being passed and they are not encoded, but when the URL is served it is encoded. How can I prevent this? The code is as...
0
by: digitalmuscle | last post by:
I have experience allowing a client to post a username and password and then returning to them a dataset. However, I need help allowing a client to post to my web service something that looks like...
5
by: dennis.mcknight | last post by:
I've created a simple guestbook and register user page, however when they are used and then re used quickly after, php doesn't seem to be getting the POST info again. For instance, if a user...
1
by: Derek Basch | last post by:
I spent several hours struggling with dynamic form fields added with appendChild or innerHTML not POSTing on submit in Firefox. The only way I found to make it work is to append any created fields...
3
by: RogerInHawaii | last post by:
I want to effectively do a Post type submit to the very same page when the user clicks on a particular radio button. Of course, I also want it to recognize the click (i.e. checkmarking the radio...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.