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>

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

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

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:

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!

Member Avatar for diafol

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.

Member Avatar for Zagga

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.