Jump to content

redirect once form is filled in


nadz

Recommended Posts

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]<?php

error_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 order
sort($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. bye

http://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

add this after your mail statement

print '<META HTTP-EQUIV="Refresh" content="4;url=http://linktoyourpagehere.com">';

make sure it is outside your loop

Change the 4 to whatever how many second you want to wait

You can also add a little line saying they will be redirected shortly

Ray
Not sure what you need this for
[code]if ($_SERVER['REQUEST_METHOD'] == 'POST')[/code]
it's really not needed, I would do this

[code]
<?php

error_reporting(E_ALL);

require('phplistgrab.php');

// check to see if the submit button has been pressed
if (isset($_POST['pie'])){
$phplistgrab = new phpListGrab($_POST['passport'], $_POST['password']);
$phplistgrab->grab();

// Sort the contact list into alphabetical order
sort($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. bye

http://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 this
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]

Hope that helps

Ray

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.