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 = 'xxxxx@xxxxx.com';

// 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.'">';
?>

Link to comment
Share on other sites

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;
 
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.