perezf Posted May 29, 2006 Share Posted May 29, 2006 can anyone help me make it so that an is not sent unless the proper textboxes which would be the users email address and comments box is filled out[code]<?php$to = "2fr3sh@gmail.com";$subject = "$idea";$from_header = "From: $from"; mail($to, $subject, $contents, $from_header); echo 'Thank You, we will be sure to get back to you as soon as possible!';?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10681-simple-php-verification/ Share on other sites More sharing options...
witt Posted May 29, 2006 Share Posted May 29, 2006 [code]<?php$to = "2fr3sh@gmail.com";$subject = "$idea";$from_header = "From: $from";if (isset($to && $subject && $from_header)) { mail($to, $subject, $contents, $from_header); echo 'Thank You, we will be sure to get back to you as soon as possible!';}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10681-simple-php-verification/#findComment-39856 Share on other sites More sharing options...
perezf Posted May 29, 2006 Author Share Posted May 29, 2006 [code]<?php$to = "2fr3sh@gmail.com";$subject = "$idea";$from_header = "From: $from";if (isset($subject && $from_header)) {mail($to, $subject, $contents, $from_header); echo 'Thank You, we will be sure to get back to you as soon as possible!';}else { echo 'Please go back and fill out the form';} ?>[/code] gives me the error[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: parse error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in /hsphere/local/home/way2fr3s/2fr3sh.com/links/email.php on line 10[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/10681-simple-php-verification/#findComment-39857 Share on other sites More sharing options...
witt Posted May 29, 2006 Share Posted May 29, 2006 Try it like so:[code]if (isset($subject) && ($from_header)) {[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10681-simple-php-verification/#findComment-39862 Share on other sites More sharing options...
AndyB Posted May 29, 2006 Share Posted May 29, 2006 Assuming that the form that gathered the information used method="post":[code]<?php$subject = trim(strip_tags($_POST['idea']));$from = trim(strip_tags($_POST['email']));$contents = trim(strip_tags($_POST['contents']));if (($from!="") && ($contents!="")) { $to = "2fr3sh@gmail.com"; $from_header = "From: ". $from; mail($to, $subject, $contents, $from_header); echo 'Thank You, we will be sure to get back to you as soon as possible!';} else { echo "You forgot something";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10681-simple-php-verification/#findComment-39863 Share on other sites More sharing options...
perezf Posted May 29, 2006 Author Share Posted May 29, 2006 it is gathered using post but using the following code[code]<?php $subject = "$idea";if (($from!="") && ($contents!="")) { $to = "2fr3sh@gmail.com"; $from_header = "From: $from"; mail($to, $subject, $contents, $from_header); echo 'Thank You, we will be sure to get back to you as soon as possible!';} else { echo "Please go back and fill the form out correctly"; ?>[/code]gives me the error message[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: parse error, unexpected $ in /hsphere/local/home/way2fr3s/2fr3sh.com/links/email.php on line 17[/quote]the code ended up working in the endthank you to all for your help[code]<?php$subject = trim(strip_tags($_POST['idea']));$from_header = trim(strip_tags($_POST['from']));$contents = trim(strip_tags($_POST['contents']));if (($from!="") && ($contents!="")) { $to = "2fr3sh@gmail.com"; $from_header = "From: ". $from; mail($to, $subject, $contents, $from_header); echo 'Thank You, we will be sure to get back to you as soon as possible!';} else { echo "You forgot something";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10681-simple-php-verification/#findComment-39865 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.