0

Possible Duplicate:
Auto Submitting a form (cURL)

I have a form which submits to a php script. In this form I need to collect all the $_POST data and then post this on to another form (the reason for this isn't really relevant but there is a good reason).

My question is once I've collected all the data from the initial form submit, sanitised it and assigned it all to variables how do i then package it all up to send to the next form? The second form is expecting a $_POST with hidden fields with particular name attributes....so how do i do this? do I build the actual html and submit that somehow to the second form or do I buld some sort of array and send that?

hope this makes sense. Kind of hard to put in to words.

1
  • 1
    Read up on cURL. Also, search around SO for submitting form POSTs via cURL with PHP. There are lots of relevant questions to guide you. Jul 19, 2011 at 12:44

3 Answers 3

2
  1. You can generate form and submit onLoad by Javascript
  2. You can use curl to send POST query (from your server but not from client)
1
  • Yeah JS would make it a trivial task but I can't as in this situation I can't expose the field names that I'm posting the data to. CURL to the rescue. Jul 19, 2011 at 15:27
0

The better way woudl be to store the sanitized variables in the session.

Collect all the information you need from all the forms you need.

Then after you have all the data needed, then finally update the DB (or Somethign else)

0

if I understood you well when you open the form you tell it wich acction will it perform .when you click submit it will take you to the other form.in the other form you can access the values of the input fields from the previous form with $_POST['name_of_the_input_field'].i hope this will help you :D

Not the answer you're looking for? Browse other questions tagged or ask your own question.