webestdesigns
webestdesigns

Reputation: 438

is it possible to send multiple forms to php self with post

I have only been able to do this with GET, How do I submit multiple forms without the previous data being lost when resubmitting a different form via POST ?

Upvotes: 2

Views: 492

Answers (4)

Rikesh
Rikesh

Reputation: 26431

Take your previous data in session array.

Or you can post your data again using hidden fields in your form.

Upvotes: 3

Andre Backlund
Andre Backlund

Reputation: 6943

This code should loop through all POST and insert them into a hidden input field. Put it inside the <form> tags, and it should be submitted with the subsequent post.

Remember to properly escape the output.

foreach($_POST as $name => $value){
    echo '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
}

Or you can save away the data in the manner you choose.

Upvotes: -1

Adam Pointer
Adam Pointer

Reputation: 1492

Persist the previous form data into a database or session.

Upvotes: 3

Calum
Calum

Reputation: 5316

Use hidden input fields?

<input type="hidden" />

Store in a session?

session_start();
$_SESSION['blarr'] = $_POST['old-data'];

Upvotes: 5

Related Questions