form problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tabatsoy
Forum Commoner
Posts: 29
Joined: Thu Mar 13, 2008 10:14 am

form problem

Post by tabatsoy »

Good Day Earthlings!!!
is it possible that if i press the submit button in a form it will redirect me in another page and still it will add in the database? if its possible, can someone please help me how to do that code.
thanks in advance :crazy:
User avatar
jamiller
Forum Commoner
Posts: 26
Joined: Mon Mar 12, 2007 12:25 pm

Re: form problem

Post by jamiller »

Can you be more specific? Looks like you simply want to add an entry into a database?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: form problem

Post by John Cartwright »

Just have your processing page redirect somewhere after it's done processing.

Code: Select all

<?php
 
if (!empty($_POST)) { 
   //validate your form here
   $valid = true;
 
   if ($valid) { 
      //enter info into db if valid
      header('Location: http://someotherpage.com');
      exit();
   }
}
 
?>
 
<form>
  <input ... >
</form>
Post Reply