0

Hi, I am really really new to this, but I'm having a bit of trouble with some php.

I have a HTML file which I have no access to, and a snippet is below:

<form onsubmit="return validate();" method="post" action="process-quiz.php">

<h2>A Simple Quiz</h2>

<fieldset>
	<legend>Name</legend>
  		<p id="UserInfo">What is your name?</p>
		<div>
			<input type="text" name="UserInfo" size="40" />
		</div>
  
</fieldset>

<fieldset>
	<legend>The questions</legend>
<ol>
	<li>
		<p id="Q1">What does this message spell?</p>
		<div>

Hopefully this shows that the HTML file has one big form with multiple data entry methods, all of which are sent to a php file via POST.

I want the PHP file to create a html page and display the answers as part of the text. I tried this:

<?php
$username=$_POST['UserInfo']; 
echo $username;?>

and various other combinations but nothing gets displayed. I think my main problem is that I don't understand what I would use to point to the text-box entry using php.

Any help would be appreciated!

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Zagga
0

Take out the 'onsubmit="return validate();"' to see if it works. If it does it's your JS script. If not, I don't know.

0

Hi xcamp,

You are using the correct code to retrieve the form data.
If you can't access the HTML file you can't remove the onsubmit call. It is likely to be the source of the problem.

Maybe try posting the code for the validate function in the javascript forum and see if anyone there can help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.