| | |
Email Form - Checkbox help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 86
Reputation:
Solved Threads: 0
i took off the echo though and replaced that with the code you gave me. What i have on my website is basically the layout and the content. The layout is in a header.php file, and the content are in the other .php's every page such as proposal .php includes the header(layout). Is there any other way i can do this then? Here is a better explanation of what i said.
Is there anyway i can do this?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
<!--
.style2 {font-size: 14px; }
-->
</style>
</head>
<body>
<?
include("../header.php"); //This includes the layout
$name= $_POST['name'];
$from = $_POST["email"];
$to = "blah@blah.com";
$subject = "Proposal Request";
$message = "Company Name: " . $_POST["companyname"] . "\n";
$message .= "Telephone Number:" . $_POST["telephonenumber"] . "\n";
$message .= "Email Address:" . $_POST["email"] . "\n";
$message .= "Company Name:" . $_POST["companyname"] . "\n";
$message .= "Company Address:" . $_POST["location"] . "\n";
$message .= "City:" . $_POST["city"] . "\n";
$message .= "State:" . $_POST["state"] . "\n";
//Checkboxes
//Service Needed
$service = $_POST['service'];
if(is_array($service))
{
$message .= "Type of Service needed:" .implode(", ",$service). "\n";
}
//Best Time to Contact
$time = $_POST['time'];
if(is_array($time))
{
$message .= "Best Time to Contact:" .implode(", ",$time). "\n";
}
//Contact Preference
$cpref = $_POST['cpref'];
if(is_array($cpref))
{
$message .= "Contact by Email/Phone:" .implode(", ",$cpref). "\n";
}
if($sent){
$headers = 'From: ' . $name . ' <' . $from . '>' . "\r\n" .
'Reply-To: ' . $from . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
//echo "The Email Has Been Sent";
header("location:thankyou.php"); //that gives me the error
}
?>Is there anyway i can do this?
Last edited by jhonnyboy; Dec 23rd, 2008 at 5:52 pm.
•
•
Join Date: Dec 2008
Posts: 20
Reputation:
Solved Threads: 1
If still u are getting error try this code in place of header("location:thankyou.php");
PHP Syntax (Toggle Plain Text)
echo "<script language='JavaScript'> location.href='thankyou.php'; </script>";
-- Manish Singh
manish.s@neuralit.com
manish.s@neuralit.com
•
•
•
•
you mean delete all the html headers and stuff? and change the extension from header.php to header.cgi?
php Syntax (Toggle Plain Text)
<?php $name= $_POST['name']; $from = $_POST["email"]; $to = "blah@blah.com"; $subject = "Proposal Request"; $message = "Company Name: " . $_POST["companyname"] . "\n"; $message .= "Telephone Number:" . $_POST["telephonenumber"] . "\n"; $message .= "Email Address:" . $_POST["email"] . "\n"; $message .= "Company Name:" . $_POST["companyname"] . "\n"; $message .= "Company Address:" . $_POST["location"] . "\n"; $message .= "City:" . $_POST["city"] . "\n"; $message .= "State:" . $_POST["state"] . "\n"; //Checkboxes //Service Needed $service = $_POST['service']; if(is_array($service)) { $message .= "Type of Service needed:" .implode(", ",$service). "\n"; } //Best Time to Contact $time = $_POST['time']; if(is_array($time)) { $message .= "Best Time to Contact:" .implode(", ",$time). "\n"; } //Contact Preference $cpref = $_POST['cpref']; if(is_array($cpref)) { $message .= "Contact by Email/Phone:" .implode(", ",$cpref). "\n"; } if($sent){ $headers = 'From: ' . $name . ' <' . $from . '>' . "\r\n" . 'Reply-To: ' . $from . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header("location:thankyou.php"); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style type="text/css"> <!-- .style2 {font-size: 14px; } --> </style> </head> <body> <?php include("../header.php"); //This includes the layout ?>
Last edited by buddylee17; Dec 23rd, 2008 at 10:20 pm.
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
![]() |
Similar Threads
- Form Validation-Alert box (JavaScript / DHTML / AJAX)
- To send Email to Selected Checkbox is not Working in PHP thru Mysql; Pls Help (PHP)
- problems with Form in dreamweaver (IT Professionals' Lounge)
- Email Form ? (HTML and CSS)
- asp:repeater in a form? (ASP.NET)
- How to pre-select checkboxes in form? (PHP)
- cannot get the sendmail to actualy send an email with the form selections (PHP)
- Javascript, Form fields validation and submit (JavaScript / DHTML / AJAX)
Other Threads in the PHP Forum
- Previous Thread: php mysql drop down list
- Next Thread: phpmyadmin displays error
| Thread Tools | Search this Thread |
ajax apache api array arrays beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external file files folder form forms forum function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction menu method mlm multiple mysql neutrality oop paypal pdf php phpmysql play problem query question radio random recursion regex remote root script search select server sessions sms soap source space sql syntax system table tutorial update upload url validator variable video web xml youtube





