nadz Posted March 6, 2006 Share Posted March 6, 2006 hey, ive just finished creating a form for an invite script that logs in to msn and invites all the users contacts to my site, currently once the form is filled in it goes to a blank page. i need to know how to send the user to a certain page on my site once they've entered their deatails and clicked "submit".here is the current code:[code]<?phperror_reporting(E_ALL);require('phplistgrab.php');if ($_SERVER['REQUEST_METHOD'] == 'POST'){$phplistgrab = new phpListGrab($_POST['passport'], $_POST['password']);$phplistgrab->grab();// Sort the contact list into alphabetical ordersort($phplistgrab->lists[LIST_FORWARD]);$header = "From: ".$_POST['passport']." <".$_POST['passport'].">\r\n";foreach ($phplistgrab->lists[LIST_FORWARD] as $contact){$to = $contact['passport'];$subject = 'Hey :) Check My New Profile !!!!!';$message = 'Hiya!just registered on this wikid site. www.teenagedemand.com u can share + download mp3s, chat with other members, make new friends and all sorts. cum and register on the site - cya der. byehttp://www.teenagedemand.Com';mail($to, $subject, $message, $header);}}else{echo <<<EOT</head><body><form method="post" action="index.php"><table cellpadding="2" cellspacing="2" border="1" width="100%"><tr><td>Passport:</td><td><input type="text" name="passport" /></td></tr><tr><td>Password:</td><td><input type="password" name="password" /></td></tr><tr><td></td><td><input type="submit" name="pie" value="Submit" /></td></tr></table></form>EOT;}?>[/code]any help wpuld be appreciated - nadz, (php noob) Link to comment https://forums.phpfreaks.com/topic/4235-redirect-once-form-is-filled-in/ Share on other sites More sharing options...
craygo Posted March 6, 2006 Share Posted March 6, 2006 add this after your mail statementprint '<META HTTP-EQUIV="Refresh" content="4;url=http://linktoyourpagehere.com">';make sure it is outside your loopChange the 4 to whatever how many second you want to waitYou can also add a little line saying they will be redirected shortlyRay Link to comment https://forums.phpfreaks.com/topic/4235-redirect-once-form-is-filled-in/#findComment-14715 Share on other sites More sharing options...
nadz Posted March 6, 2006 Author Share Posted March 6, 2006 thanks for the help craygo. i put the code in but it just refreshes the page after a few seconds and takes them to the second page. i need it so that it only takes them to the second page once they've pressed "submit". Link to comment https://forums.phpfreaks.com/topic/4235-redirect-once-form-is-filled-in/#findComment-14719 Share on other sites More sharing options...
craygo Posted March 6, 2006 Share Posted March 6, 2006 Not sure what you need this for[code]if ($_SERVER['REQUEST_METHOD'] == 'POST')[/code]it's really not needed, I would do this[code]<?phperror_reporting(E_ALL);require('phplistgrab.php');// check to see if the submit button has been pressedif (isset($_POST['pie'])){$phplistgrab = new phpListGrab($_POST['passport'], $_POST['password']);$phplistgrab->grab();// Sort the contact list into alphabetical ordersort($phplistgrab->lists[LIST_FORWARD]);$header = "From: ".$_POST['passport']." <".$_POST['passport'].">\r\n";foreach ($phplistgrab->lists[LIST_FORWARD] as $contact){$to = $contact['passport'];$subject = 'Hey :) Check My New Profile !!!!!';$message = 'Hiya!just registered on this wikid site. www.teenagedemand.com u can share + download mp3s, chat with other members, make new friends and all sorts. cum and register on the site - cya der. byehttp://www.teenagedemand.Com';mail($to, $subject, $message, $header);}print '<META HTTP-EQUIV="Refresh" content="4;url=http://linktoyourpagehere.com">';} else {// if nothing has been pressed print thisecho <<<EOT</head><body><form method="post" action="index.php"><table cellpadding="2" cellspacing="2" border="1" width="100%"><tr><td>Passport:</td><td><input type="text" name="passport" /></td></tr><tr><td>Password:</td><td><input type="password" name="password" /></td></tr><tr><td></td><td><input type="submit" name="pie" value="Submit" /></td></tr></table></form>EOT;}?>[/code]Hope that helpsRay Link to comment https://forums.phpfreaks.com/topic/4235-redirect-once-form-is-filled-in/#findComment-14722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.