Jump to content

Simple Form Problem


Swenglish

Recommended Posts

Hi!

 

I am not great at using php but do use it to process forms on websites.  I always use the same script and just change the relevant sections for each website.  This usually works with no problems.

 

I am writing an mailing list subscribe/unsubscribe form my website and it works fine as in I get the email sent through with all the information on it and the automated reply gets sent out etc.  The problem is that once the user hits Submit instead of going to the redirect page it stays on the php page.

 

if($from == '') {print "You have not entered an email, please go back and try again";} 
else { 
if($name == '') {print "You have not entered a company name, please go back and try again";} 
else { 
$send = mail($to, $subject, $body, $headers); 
$send2 = mail($from, $subject2, $autoreply, $headers2); 
if($send) 
{header( "Location: http://www.hillsideweb.co.uk/unsubthanks.html" );} 

 

Like I say this exact script works on another site of mine perfectly well, can someone please help me solve this.

The form is found on http://www.hillsideweb.co.uk/unsubscribe.html

 

I hope this makes sense!

Many thanks

Swenglish

 

Link to comment
Share on other sites

Make sure that send is True.  If it is then add an exit after the redirect.

if($from == '') {print "You have not entered an email, please go back and try again";} 
else { 
if($name == '') {print "You have not entered a company name, please go back and try again";} 
else { 
$send = mail($to, $subject, $body, $headers); 
$send2 = mail($from, $subject2, $autoreply, $headers2); 

if($send) 
{
echo "Send is true."; die();  // if you get this then remove this line and try it again.
header( "Location: http://www.hillsideweb.co.uk/unsubthanks.html" ); exit; } 

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.