0

I want to redirect my form to a php page after submit and after data of the form have been inserted (in a correct way) in my database. I use action="insert-data.php" to insert data but I want to redirect the user to a different php page (that is not a welcome page). How can i redirect him after the insert? Thanks a lot.

Gio
  • 155
  • 1
  • 5
  • 13
  • look in the manual for the header() function –  Jun 09 '13 at 21:37
  • Ok, so adding the header I use the insert-data.php to insert data but i'm being redirected to another page, isn't it? – Gio Jun 09 '13 at 22:13
  • But Have I to use insert-data.php (where I would insert my header) as external page or can I call the action in the same page of the form? @Dagon, thanks. – Gio Jun 09 '13 at 22:21

1 Answers1

2

use header("Location: http://example.com/page.html"); but make sure you don´t print or echo anything, no output at all before that call.

PeeHaa
  • 69,318
  • 57
  • 185
  • 258
luk2302
  • 50,400
  • 22
  • 92
  • 131