egolddude
asked on
How to avoid some values to be sent to email (Simple PHP Contact Form)
I know simple PHP Contact Form (or submitted forms to be sent to email).
Goes like this (in 3 steps) : form.htm .. > .. submit.php .. > .. submitted.htm
** ON form.htm **
<form method="post" action"submit.php">
Name: <input type="text" name="name"><br>
Address: <input type="text" name="address"><br>
City: <input type="text" name="city"><br>
State: <input type="text" name="state"><br>
ZipCode: <input type="text" name="zip">
</form>
** ON submit.php **
<?
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$msg = "Details Submitted:\n
Name: $name\n
Address: $address\n
City: $city\n
State: $state\n
ZipCode: $zip\n";
mail("myemail@yahoo.com", "Simple Form Submitted", $msg);
header("Location: submitted.htm");
?>
** ON submitted.htm **
Just a THANK YOU page.
WHAT I WANT ...
---------------------
I dont want to put a JavaScript Form Validation (yes, even a blank form can be submitted) BUT I want the form ONLY submits the field(s) that a client filled. Can someone helps in modifying the PHP Codes ?
So, if a client fill all fields, I should receive reports like this on my email:
-------------------------- ---------- -------
Details Submitted:
Name: John Doe
Address: Route 66
City: Los Angeles
State: California
ZipCode: 90028
-------------------------- ---------- -------
And, if a client only fill 1 field then I should ONLY receive reports like this on my email (which cannot be done with the PHP Codes as above):
-------------------------- ---------- -------
Details Submitted:
Name: Britney Spears
-------------------------- ---------- -------
Any answers OR suggestions are gladly welcomed ... Thanks.
Goes like this (in 3 steps) : form.htm .. > .. submit.php .. > .. submitted.htm
** ON form.htm **
<form method="post" action"submit.php">
Name: <input type="text" name="name"><br>
Address: <input type="text" name="address"><br>
City: <input type="text" name="city"><br>
State: <input type="text" name="state"><br>
ZipCode: <input type="text" name="zip">
</form>
** ON submit.php **
<?
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$msg = "Details Submitted:\n
Name: $name\n
Address: $address\n
City: $city\n
State: $state\n
ZipCode: $zip\n";
mail("myemail@yahoo.com", "Simple Form Submitted", $msg);
header("Location: submitted.htm");
?>
** ON submitted.htm **
Just a THANK YOU page.
WHAT I WANT ...
---------------------
I dont want to put a JavaScript Form Validation (yes, even a blank form can be submitted) BUT I want the form ONLY submits the field(s) that a client filled. Can someone helps in modifying the PHP Codes ?
So, if a client fill all fields, I should receive reports like this on my email:
--------------------------
Details Submitted:
Name: John Doe
Address: Route 66
City: Los Angeles
State: California
ZipCode: 90028
--------------------------
And, if a client only fill 1 field then I should ONLY receive reports like this on my email (which cannot be done with the PHP Codes as above):
--------------------------
Details Submitted:
Name: Britney Spears
--------------------------
Any answers OR suggestions are gladly welcomed ... Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You're rite man ...
The points are on YOU ....
Thanks.