Jump to content

confirm email and redirect to a confirmation page


vinnyvg

Recommended Posts

For about 2/3 years  I have had a purchase order form - which  sends the forms returns to the recipient by email.

After the form is sent, the user  will then see a confirmation page - with  links back to the main site.

 

Two things happened

1, The site owner changed  hosts and  now uses 1&1 UK - who recently seemed to have changed teh server PHP handling - now giving options PHP5.5 - 5.4 and dev.

2. The site owner has had an IT guy take over email "security"  who then installed an Windows 2003 sever on the  hosting.

 

I am  notified thr form has stoppped working -  looking at the obvious I assumed that changing PHP settings affected the form.

But on  test site on my 1&1 server.... the forms sends a retuen by email.

 

My problem is that now, the sendresults script seems to be affected !  There is no redirect to the confirmation page and no error page is returned.

The screen  goes white, no content. The  URL shows the same  form page path.

 

I got the  original scripts of a Dreamweaver forum long ago... which is now demised.

 

In a search I have  found similar probems and no solutions....

 

I have two questions - ppppplease can anybody offer a workaround to get the desired results or  is their a way to cut the  form after the email is sent and have a link back to the site.. or another workaround to achieve the same result.

 

Finally and sadly, what I know about  PHP would not,  while using a felt  marker and big letters, fill the back of a stamp.

 

Any offers of help will be greatly appreciated.

 

TIA,

 

Art

 

 

      <?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Results from Contact form';

// Your email address. This is where the form information will be sent.
$emailadd = '[email protected]';

// Where to redirect after form is processed.
$url = 'http://www.xxxxxxxxxxxx.com';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="3; URL='.$url.'">';
?>

Two things you can try;

 

Replace that echo with

 

 

exit(header("location:http://www.urlofsitegoeshere.com"));

 

or if that gives you an "headers already sent" error, then use

 

 

$string = '<script type="text/javascript">';
$string .= 'window.location = "'http://www.urlgoeshere.../whereWeGo/'"';
$string .= '</script>';
 
echo $string;
 

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.