perezf Posted September 20, 2006 Share Posted September 20, 2006 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 = "2fr3sh@gmail.com";$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] Quote Link to comment Share on other sites More sharing options...
Gruzin Posted September 20, 2006 Share Posted September 20, 2006 you can use "empty" or "strlen" functions to avoid sending blank forms. like this:[code]if(empty($name)){ echo "please fill in the name"; exit();}// continue here[/code] Quote Link to comment Share on other sites More sharing options...
perezf Posted September 20, 2006 Author Share Posted September 20, 2006 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 = "2fr3sh@gmail.com";$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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.