Page 1 of 1

Regarding redirect page in php

Posted: Thu Sep 25, 2008 12:49 am
by saran_tvmalai
hi all,
the below file name is saran.php

Code: Select all

 
[b]<form action="insert.php" method="post" name=" ">
Email Id  <input type="text" name="emailid" /><br>
ResiPhone No  <input type="text" name="resph" /><br>
Office Ph  <input type="text" name="offph" /><br>
Mobile No  <input type="text" name="mobile" /><br>
<input type="submit" />
</form>[/b]
 
And the insert.php is

Code: Select all

 
<?php
 
$con = mysql_connect('localhost','root','');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 
mysql_select_db("mydb", $con);
 
$sql="INSERT INTO los_master_detail (email,phone,resphone,mobile)
VALUES
('$_POST[email]','$_POST[phone]','$_POST[resphon]','$_POST[mob]')";
 
if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
 
  echo("<SCRIPT LANGUAGE='JavaScript'>
window.alert('1 Record Has Been Updated')
</SCRIPT>");
 
mysql_close($con)
?>

And after the record update the message box is enable. i need if i click the message box ok button it redirect to saran.php.

Re: Regarding redirect page in php

Posted: Thu Sep 25, 2008 1:26 am
by Christopher
Use Javascript to check the return value of the alert and redirect.

Re: Regarding redirect page in php

Posted: Thu Sep 25, 2008 2:51 am
by ramya123
Place this line of code
window.location.href="saran.php";

after
window.alert('1 Record Has Been Updated')