Jump to content

How to stop an email from being sent "Required Fields"


perezf

Recommended Posts

i made this code to send an email but i dont want anything sent if the user doesnt fill in required fields


[code]<?php
$from_header = "From: ".$_POST['from'];
$name = $_POST['name'];
$to = "[email protected]";
$heading = "2fr3sh Email";
$contents = $_POST['message'];

if(isset($from_header)) && if(isset($contents)) {
mail($to, $heading, $contents, $from_header);
} else {header("Location: contact.html");}
?>[/code]
i want to try and stick to the issets and im getting the following code error
[quote]Parse error: parse error, unexpected T_BOOLEAN_AND in /hsphere/local/home/way2fr3s/2fr3sh.com/new/sendmail.php on line 24[/quote]
[code]<?php
$from_header = "From: ".$_POST['from'];
$name = $_POST['name'];
$to = "[email protected]";
$heading = "2fr3sh Email";
$contents = $_POST['message'];

if(isset($from_header)) && if(isset($contents)) {
mail($to, $heading, $contents, $from_header);
} else {header("Location: contact.html");}
?>[/code]

Archived

This topic is now archived and is closed to further replies.

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