+2  A: 

From the sound of your question what you're trying to do doesn't make sense. This is because PHP is a server side language while Javascript is a client side (in the browser). This means that Javascript, and therefore jQuery, don't have access to PHP's variables ($_POST included).

There are two common ways to solve this:

  • Have PHP generate the form. You would output the values from $_POST, or another data location, into the form (ex., echo the variable into the input tag's value attribute). This is by far the easiest method. For example: printf('<input type="text" name="foo" value="%s"/>', $someCleanVariable);

  • Have the PHP generate JSON or XML, and use AJAX to get the data from the PHP script. You would have to parse out the values into the form. This is basically the same as the previous example, except it's more portable: you can have any source consume the data instead of just your form.

However, make sure that you protect your users when doing this: you need to clean the data that you're sending back to the user to make sure that there is no HTML, Javascript, or other malicious code in it. You don't want people being able to alter the look of your page by passing it data. See Cross-site Scripting Attacks.

Cheers.

Sam Bisbee
will edit my post to hopefully make more sense lol
SoulieBaby
My answer still applies. :-)You're going to use jQuery to swap out the HTML elements, but use PHP to write the elements to the page. For your example, have the results page output the redo form with the CSS attribute `display: none;`. Then, if they click the "try again" button, you can select the form and make it visible with jQuery: `$('div#formContainer').show();`Hope that helps.
Sam Bisbee
lol ok thank you for your help! :)
SoulieBaby
Quite welcome. :-) Good luck with your project.
Sam Bisbee