m4tt1986 Posted March 6, 2008 Share Posted March 6, 2008 Hi, I am creating a website for my insurance company in spain. I used a php form to email generator from turning turnip. the following code is the code that send the form to my email address: <?php $name = Trim($_POST['name']); $address = Trim($_POST['address']); $postcode = Trim($_POST['postcode']); $telephone = Trim($_POST['telephone']); $email = Trim($_POST['email']); $dob = Trim($_POST['dob']); $gender = Trim($_POST['gender']); $license_held_since = Trim($_POST['license_held_since']); $no_claims_entitlement = Trim($_POST['no_claims_entitlement']); $any_drivers_under_25 = Trim($_POST['any_drivers_under_25']); $cover_type = Trim($_POST['cover_type']); $registered_country = Trim($_POST['registered_country']); $registration_plate = Trim($_POST['registration_plate']); $make = Trim($_POST['make']); $model = Trim($_POST['model']); $year = Trim($_POST['year']); $engine_size = Trim($_POST['engine_size']); $fuel_type = Trim($_POST['fuel_type']); $password = Trim($_POST['password']); $EmailTo = "[email protected]"; $Subject = "Motor Quote"; /// Add a subject $Body .= "name:\n$name\n\n"; $Body .= "address:\n$address\n\n"; $Body .= "postcode:\n$postcode\n\n"; $Body .= "telephone:\n$telephone\n\n"; $Body .= "email:\n$email\n\n"; $Body .= "dob:\n$dob\n\n"; $Body .= "gender:\n$gender\n\n"; $Body .= "license held since:\n$license_held_since\n\n"; $Body .= "no claims entitlement:\n$no_claims_entitlement\n\n"; $Body .= "any drivers under 25:\n$any_drivers_under_25\n\n"; $Body .= "cover type:\n$cover_type\n\n"; $Body .= "registered country:\n$registered_country\n\n"; $Body .= "registration plate:\n$registration_plate\n\n"; $Body .= "make:\n$make\n\n"; $Body .= "model:\n$model\n\n"; $Body .= "year:\n$year\n\n"; $Body .= "engine size:\n$engine_size\n\n"; $Body .= "fuel type:\n$fuel_type\n\n"; $Body .= "password:\n$password\n\n"; $Body .= "opt-in:\n$opt-in\n\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$email>"); if ($success){ echo "Thank you, your quote has been submitted. A member of the sales department will be in touch.";} else{ echo "Error! Your quote has not been submitted! Please phone us on 968 429 129 or 680 525 108";} ?> rather than display the text in red I would like it to automatically redirect to another page as I am adding an affiliate script, which needs a sales page (we dont have a sales page so I need the script to identify when a customer has sent the form. Could anybody help complete the code to redirect to a page called success.html Kind regards Link to comment https://forums.phpfreaks.com/topic/94707-php-redirection/ Share on other sites More sharing options...
peranha Posted March 6, 2008 Share Posted March 6, 2008 Reload user to the success.html page added the following line. header("Location: success.html"); Not sure, but I believe this will work. <?php $name = Trim($_POST['name']); $address = Trim($_POST['address']); $postcode = Trim($_POST['postcode']); $telephone = Trim($_POST['telephone']); $email = Trim($_POST['email']); $dob = Trim($_POST['dob']); $gender = Trim($_POST['gender']); $license_held_since = Trim($_POST['license_held_since']); $no_claims_entitlement = Trim($_POST['no_claims_entitlement']); $any_drivers_under_25 = Trim($_POST['any_drivers_under_25']); $cover_type = Trim($_POST['cover_type']); $registered_country = Trim($_POST['registered_country']); $registration_plate = Trim($_POST['registration_plate']); $make = Trim($_POST['make']); $model = Trim($_POST['model']); $year = Trim($_POST['year']); $engine_size = Trim($_POST['engine_size']); $fuel_type = Trim($_POST['fuel_type']); $password = Trim($_POST['password']); $EmailTo = "[email protected]"; $Subject = "Motor Quote"; /// Add a subject $Body .= "name:\n$name\n\n"; $Body .= "address:\n$address\n\n"; $Body .= "postcode:\n$postcode\n\n"; $Body .= "telephone:\n$telephone\n\n"; $Body .= "email:\n$email\n\n"; $Body .= "dob:\n$dob\n\n"; $Body .= "gender:\n$gender\n\n"; $Body .= "license held since:\n$license_held_since\n\n"; $Body .= "no claims entitlement:\n$no_claims_entitlement\n\n"; $Body .= "any drivers under 25:\n$any_drivers_under_25\n\n"; $Body .= "cover type:\n$cover_type\n\n"; $Body .= "registered country:\n$registered_country\n\n"; $Body .= "registration plate:\n$registration_plate\n\n"; $Body .= "make:\n$make\n\n"; $Body .= "model:\n$model\n\n"; $Body .= "year:\n$year\n\n"; $Body .= "engine size:\n$engine_size\n\n"; $Body .= "fuel type:\n$fuel_type\n\n"; $Body .= "password:\n$password\n\n"; $Body .= "opt-in:\n$opt-in\n\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$email>"); if ($success){ echo header("Location: success.html");} else{ echo "Error! Your quote has not been submitted! Please phone us on 968 429 129 or 680 525 108";} ?> Link to comment https://forums.phpfreaks.com/topic/94707-php-redirection/#findComment-484859 Share on other sites More sharing options...
m4tt1986 Posted March 6, 2008 Author Share Posted March 6, 2008 I copy and pasted the code below and it gave me this error: Parse error: parse error, unexpected '<' in /homepages/27/d145037045/htdocs/MSCINSURE/msend.php on line 47 Link to comment https://forums.phpfreaks.com/topic/94707-php-redirection/#findComment-484864 Share on other sites More sharing options...
mysterbx Posted March 6, 2008 Share Posted March 6, 2008 it wount... you have // in your one line script... use this: <?php $name = Trim($_POST['name']); $address = Trim($_POST['address']); $postcode = Trim($_POST['postcode']); $telephone = Trim($_POST['telephone']); $email = Trim($_POST['email']); $dob = Trim($_POST['dob']); $gender = Trim($_POST['gender']); $license_held_since = Trim($_POST['license_held_since']); $no_claims_entitlement = Trim($_POST['no_claims_entitlement']); $any_drivers_under_25 = Trim($_POST['any_drivers_under_25']); $cover_type = Trim($_POST['cover_type']); $registered_country = Trim($_POST['registered_country']); $registration_plate = Trim($_POST['registration_plate']); $make = Trim($_POST['make']); $model = Trim($_POST['model']); $year = Trim($_POST['year']); $engine_size = Trim($_POST['engine_size']); $fuel_type = Trim($_POST['fuel_type']); $password = Trim($_POST['password']); $EmailTo = "[email protected]"; $Subject = "Motor Quote"; $Body .= "name:\n$name\n\n"; $Body .= "address:\n$address\n\n"; $Body .= "postcode:\n$postcode\n\n"; $Body .= "telephone:\n$telephone\n\n"; $Body .= "email:\n$email\n\n"; $Body .= "dob:\n$dob\n\n"; $Body .= "gender:\n$gender\n\n"; $Body .= "license held since:\n$license_held_since\n\n"; $Body .= "no claims entitlement:\n$no_claims_entitlement\n\n"; $Body .= "any drivers under 25:\n$any_drivers_under_25\n\n"; $Body .= "cover type:\n$cover_type\n\n"; $Body .= "registered country:\n$registered_country\n\n"; $Body .= "registration plate:\n$registration_plate\n\n"; $Body .= "make:\n$make\n\n"; $Body .= "model:\n$model\n\n"; $Body .= "year:\n$year\n\n"; $Body .= "engine size:\n$engine_size\n\n"; $Body .= "fuel type:\n$fuel_type\n\n"; $Body .= "password:\n$password\n\n"; $Body .= "opt-in:\n$opt-in\n\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$email>"); if ($success){ echo header("Location: success.html");} else{ echo "Error! Your quote has not been submitted! Please phone us on 968 429 129 or 680 525 108";} ?> Link to comment https://forums.phpfreaks.com/topic/94707-php-redirection/#findComment-484870 Share on other sites More sharing options...
m4tt1986 Posted March 6, 2008 Author Share Posted March 6, 2008 I still cant get it to work even with any of the above. the code I have as it stands is: <?php $name = Trim($_POST['name']); $address = Trim($_POST['address']); $postcode = Trim($_POST['postcode']); $telephone = Trim($_POST['telephone']); $email = Trim($_POST['email']); $dob = Trim($_POST['dob']); $gender = Trim($_POST['gender']); $license_held_since = Trim($_POST['license_held_since']); $no_claims_entitlement = Trim($_POST['no_claims_entitlement']); $any_drivers_under_25 = Trim($_POST['any_drivers_under_25']); $cover_type = Trim($_POST['cover_type']); $registered_country = Trim($_POST['registered_country']); $registration_plate = Trim($_POST['registration_plate']); $make = Trim($_POST['make']); $model = Trim($_POST['model']); $year = Trim($_POST['year']); $engine_size = Trim($_POST['engine_size']); $fuel_type = Trim($_POST['fuel_type']); $password = Trim($_POST['password']); $EmailTo = "[email protected]"; $Subject = "Motor Quote"; /// Add a subject $Body .= "name:\n$name\n\n"; $Body .= "address:\n$address\n\n"; $Body .= "postcode:\n$postcode\n\n"; $Body .= "telephone:\n$telephone\n\n"; $Body .= "email:\n$email\n\n"; $Body .= "dob:\n$dob\n\n"; $Body .= "gender:\n$gender\n\n"; $Body .= "license held since:\n$license_held_since\n\n"; $Body .= "no claims entitlement:\n$no_claims_entitlement\n\n"; $Body .= "any drivers under 25:\n$any_drivers_under_25\n\n"; $Body .= "cover type:\n$cover_type\n\n"; $Body .= "registered country:\n$registered_country\n\n"; $Body .= "registration plate:\n$registration_plate\n\n"; $Body .= "make:\n$make\n\n"; $Body .= "model:\n$model\n\n"; $Body .= "year:\n$year\n\n"; $Body .= "engine size:\n$engine_size\n\n"; $Body .= "fuel type:\n$fuel_type\n\n"; $Body .= "password:\n$password\n\n"; $Body .= "opt-in:\n$opt-in\n\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$email>"); if ($success){ echo echo header("Location: success.html");} else{ echo "Error! Your quote has not been submitted! Please phone us on 968 429 129 or 680 525 108";} ?> Link to comment https://forums.phpfreaks.com/topic/94707-php-redirection/#findComment-484905 Share on other sites More sharing options...
peranha Posted March 6, 2008 Share Posted March 6, 2008 I still cant get it to work even with any of the above. the code I have as it stands is: <?php $name = Trim($_POST['name']); $address = Trim($_POST['address']); $postcode = Trim($_POST['postcode']); $telephone = Trim($_POST['telephone']); $email = Trim($_POST['email']); $dob = Trim($_POST['dob']); $gender = Trim($_POST['gender']); $license_held_since = Trim($_POST['license_held_since']); $no_claims_entitlement = Trim($_POST['no_claims_entitlement']); $any_drivers_under_25 = Trim($_POST['any_drivers_under_25']); $cover_type = Trim($_POST['cover_type']); $registered_country = Trim($_POST['registered_country']); $registration_plate = Trim($_POST['registration_plate']); $make = Trim($_POST['make']); $model = Trim($_POST['model']); $year = Trim($_POST['year']); $engine_size = Trim($_POST['engine_size']); $fuel_type = Trim($_POST['fuel_type']); $password = Trim($_POST['password']); $EmailTo = "[email protected]"; $Subject = "Motor Quote"; /// Add a subject $Body .= "name:\n$name\n\n"; $Body .= "address:\n$address\n\n"; $Body .= "postcode:\n$postcode\n\n"; $Body .= "telephone:\n$telephone\n\n"; $Body .= "email:\n$email\n\n"; $Body .= "dob:\n$dob\n\n"; $Body .= "gender:\n$gender\n\n"; $Body .= "license held since:\n$license_held_since\n\n"; $Body .= "no claims entitlement:\n$no_claims_entitlement\n\n"; $Body .= "any drivers under 25:\n$any_drivers_under_25\n\n"; $Body .= "cover type:\n$cover_type\n\n"; $Body .= "registered country:\n$registered_country\n\n"; $Body .= "registration plate:\n$registration_plate\n\n"; $Body .= "make:\n$make\n\n"; $Body .= "model:\n$model\n\n"; $Body .= "year:\n$year\n\n"; $Body .= "engine size:\n$engine_size\n\n"; $Body .= "fuel type:\n$fuel_type\n\n"; $Body .= "password:\n$password\n\n"; $Body .= "opt-in:\n$opt-in\n\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$email>"); if ($success){ header("Location: success.html");} else{ echo "Error! Your quote has not been submitted! Please phone us on 968 429 129 or 680 525 108";} ?> In the code, I gave you I didnt realize it had echo in it. These should not be there. I fixed it in your code above, try that. Link to comment https://forums.phpfreaks.com/topic/94707-php-redirection/#findComment-484912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.