mmarif4u Posted April 30, 2007 Share Posted April 30, 2007 Hi guys . I have the following code, how can i redirect the user to message.php after submitting the form or page. <?php //ob_start(); include('../common/adm_inc_commons.php'); $sql="select * from m_user where nruser = $nruser"; $result = mysql_query($sql) or err_handler(); $row = mysql_fetch_object($result); $nmname=$row->nmname; $nmpass=$row->nmpassword; $nmlogin=$row->nmlogin; $nric=$row->nric; $nmemail=$row->nmemail; //****************************************************************************** $sql1="select * from m_parent_child where nruser=$nruser"; $result_list= mysql_query($sql1) or err_handler(); $row = mysql_fetch_array($result); $childarray=$row->nruser_child; //********************************************************************************************* $sql="select * from m_user where nruser='$childarray' and cdcat='2'"; $result_child= mysql_query($sql) or mysql_error(); $row_child = mysql_fetch_array($result_child); $name=$row_child->nmname; $login=$row_child->nmlogin; $pass=$row_child->nmpassword; //******************************************************************************************** if (isset($_POST['btnsave_x'])) { $email =htmlentities($_POST['nmemail']); $msg =($_POST['message']); $subject =htmlentities($_POST['subject']); $headers = 'From: Straight-As Team <[email protected]>' . "\r\n" . 'Cc: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion() ."\r\n". 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = " Dear valued subscriber,<br> Welcome to Straight-As Program.<br> Thank you for showing interest in Straight-As program.<br><br> ".$msg." <br> Kindly keep the above information for future references.<br> For further information please contact:<br> [email protected].<br> Best regards,<br> Straight-As Team. "; $mail=mail($email,$subject,$message,$headers); } // If (!$mail'){header("Location:message.php");}//else {header("Location:message.php");} // header("Location:message.php"); ?> <html> <head> <title>Straight-As:Customer</title> </head> <?php include('../common/adm_inc_top.php'); ?> <body> <?PHP include('adm_cus_send_pass_form.php')?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/49273-solved-redirect-user/ Share on other sites More sharing options...
sanfly Posted April 30, 2007 Share Posted April 30, 2007 There are two ways I know of, just plug in the code wherever you want it to go: <?php header("Location: URL GOES HERE"); ?> but I find that never works for me and the way I code, I always get "header already sent" errors so, i use javascript <?php // some php here ?> <script> window.location = "URL GOES HERE"; </script> <?php // some other php here ?> EDIT: Just read more carefully. Put it just after the mail() function, but before the } Link to comment https://forums.phpfreaks.com/topic/49273-solved-redirect-user/#findComment-241448 Share on other sites More sharing options...
mmarif4u Posted April 30, 2007 Author Share Posted April 30, 2007 Thanks... Got sloved Link to comment https://forums.phpfreaks.com/topic/49273-solved-redirect-user/#findComment-241450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.