×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to submit a form ?
2

How to submit a form ?

How to submit a form ?

(OP)
Hello everyone,

I know this is kind of a basic question but no matter how much I google, I just can't figure out how to do it ... sad

I have several forms. Each with a question you can answer checking one of the provided radio buttons. Like this:

CODE

<form action="radio.html" method="post">
<p>1. Question</p>
<fieldset>
<input type="radio" id="PG01S01" name="PG01" value="0">
<label for="PG01S01"> Answer 1</label>
<br>
<input type="radio" id="PG01S02" name="PG01" value="1">
<label for="PG01S02"> Answer 2</label>
</fieldset>
</form>

<form action="radio.html" method="post">
<p>2. Question</p>
<fieldset>
<input type="radio" id="PG02S02" name="PG02" value="0">
<label for="PG02S01"> Answer 1</label>
<br>
<input type="radio" id="PG02S02" name="PG02" value="1">
<label for="PG02S02"> Answer 2</label>
</fieldset>
</form>

... and so on 

Now the first thing I fail to accomplish is to provide a button that's supposed to submit the answers into an evluation script. Something I tried was:

CODE

<form action="eval.php" method="POST" name="Evaluation" id="HP2">
<p align="center">
<input type="Submit" name="Engage2" id="E2" value="Submit Answers" />
</form> 

But this isn't going to pass anything to eval.php and I have no idea how to make it do so.

Next problem:

The eval.php is supposed to check all the answers. I the value of an answer is "1" then a counter shall be increased by one and if the value is "0" then the counter shall not be increased.

At the end case the counter has a certain value another page with information is supposed to be displayed. If the counter is too low the Question form is supposed to be repeated.

Is there anyone who could help me out with that ?

Best Regards,
Thomas

RE: How to submit a form ?

Quote:

But this isn't going to pass anything to eval.php and I have no idea how to make it do so.

No, that is EXACTLY what that code will do, provided that your form data input elements are placed in between the <form ... > opening tag and the </form> closing tag.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: How to submit a form ?

You want to put all of the form elements within one form tag. Each acts as its own entity.

CODE --> php

<form action="eval.php" method="POST" name="Evaluation" id="HP2">
<p>1. Question</p>
<fieldset>
<input type="radio" id="PG01S01" name="PG01" value="0">
<label for="PG01S01"> Answer 1</label>
<br>
<input type="radio" id="PG01S02" name="PG01" value="1">
<label for="PG01S02"> Answer 2</label>
</fieldset>
<p>2. Question</p>
<fieldset>
<input type="radio" id="PG02S02" name="PG02" value="0">
<label for="PG02S01"> Answer 1</label>
<br>
<input type="radio" id="PG02S02" name="PG02" value="1">
<label for="PG02S02"> Answer 2</label>
</fieldset>
<p align="center">
<input type="Submit" name="Engage2" id="E2" value="Submit Answers" />

</form> 

If you can't stand behind your troops, stand in front of them.
Semper Fidelis

Jim

RE: How to submit a form ?

The first thing to understand is how html forms work. An HTML form will submit any and all elements with in it. But will absolutely not submit elements from other forms on the same page at all.
Forms are independent of each other. Having several forms with no submit button, and then one form with a submit button, will only ever submit the form with the submit button.

So basically what you have is several pointless forms, and one form that will only ever submit the value for the submit button.

If you need to submit the radio boxes, either have them all in the same form with a submit button,. or give each of their forms a submit button and point them to correct script.

This however has pretty much nothing to do with PHP, its basic HTML at this point.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: How to submit a form ?

(OP)
Thanks a lot for all the Input.
Everything is working fine now !

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close