frank_solo Posted May 19, 2013 Share Posted May 19, 2013 How do I print isset on this form? Thanks <?php $var = $result['email']; if (!empty($var)) { if (isset($_POST['submit'])) { if(isset($_POST['answer']) && $_POST['answer'] == '2'){ $to = "$var"; // change to your email address $name = htmlspecialchars ($_POST['name']); $email = htmlspecialchars ($_POST['email']); $phone = htmlspecialchars ($_POST['phone']); $msg = htmlspecialchars ($_POST['msg']); $d = date('l dS \of F Y h:i:s A'); $sub = "My Domain RE:".$result['title'].""; $headers = "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes = "phone: ".$phone."\n"; $mes .= "Message: ".$msg."\n"; $mes .= "Name: ".$name."\n"; $mes .= 'Email: '.$email."\n"; $mes .= 'Date & Time: '.$d; mail($to, $sub, $mes, $headers); echo "<div align='center'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>Email Has Been Sent</span></div>"; } else { echo "<div align='center'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>ANSWER does not match! </span></div>"; } } echo "<div align='center'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #00F;'>Email: ".$result['contact']."</span></div> <form method='post' action='apt.php?id=$id' name='contact' onSubmit='return Blank_TextField_Validator()'> <input name='name' type='text' size='40' placeholder='Name' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['name'])."'/><br> <input name='email' type='text' size='40' placeholder='Email' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['email'])."'/><br> <input name='phone' type='text' size='40' placeholder='Phone' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['phone'])."'/><br> <textarea name='msg' cols='29' rows='4' value='".preg_replace('/[^a-z\-_0-9\.:\/]/i','',$_POST['msg'])."' id='msg'></textarea><br> <div align='left'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 12px; color: #000;'>What is 2 + 2? </span><br><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 12px; color: #000;'>Answer: </span><input name='answer' type='text' id='answer' size='3' maxlength='3' /><input type='submit' class='button4' value='Send' name='submit' /></div> </form><br><br><br>";}?> 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.