Log in

View Full Version : Add auto email reply to this form



netanel
07-19-2015, 12:42 PM
Hi everybody.
I have this registration form and I want to add auto replay after user fill the fields and press send. can someone help me with this issue? thanks a lot!
This is the code:



<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) {
exit;
}
/**
* Full Content Template
*
Template Name: Full Width Page (no sidebar)
*/
get_header(); ?>
<div id="content-full" class="grid col-940">
<div class="post-entry">
<?php
global $wpdb;
$table_name = $wpdb->prefix . 'login';
$count_query = "select count(*) from $table_name";
$num = $wpdb->get_var($count_query);
$arr = str_split(str_pad($num, 4, "0195", STR_PAD_LEFT));
//print_r($arr);
if(isset($_POST['uname']) && $_POST['email'] && $_POST['phone']){
$uname = $_POST['uname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$q = "INSERT INTO wp_login(uname, email, phone) VALUES ('$uname','$email','$phone')";
mysql_query($q)or die(mysql_error());
echo "!תודה רבה. ההרשמה בוצעה בהצלחה. יחד נשנה את עתיד השומרון";
echo "<style>
.post-entry {
clear: both;
font-size: 30px;
background: #8EC63F;
padding: 10px;
margin: 60px 20px;
text-align: center;
color: #fff;
}
</style>";
exit;
}
?>
<div id="count">
<div class="divf" style="border-top-left-radius: 10px;border-bottom-left-radius: 10px;"> <?php echo $arr['0'];?> </div>
<div class="divf"> <?php echo $arr['1'];?> </div>
<div class="divf"> <?php echo $arr['2'];?> </div>
<div class="divf" style="border-top-right-radius: 10px;border-bottom-right-radius: 10px;"> <?php echo $arr['3'];?> </div>
</div>
<form name="myform" action="" method="POST">
<div id="form">
<ul>
<li><input type="email" name="email" id="uemail" required></li>
<li><input type="text" name="phone" id="upass" required></li>
<li><input type="text" name="uname" placeholder="" id="uname" required></li>
</ul>

<div class="fb-share-button" data-href="http://demski.co.il/" data-layout="icon"><a href="http://www.facebook.com/sharer.php?u=http://demski.co.il
&t=<שריה דמסקי, עושה באמת>"><img src="<?php bloginfo('template_url')?>/images/facebook_btn.png"> </a></div>
</div>
</div>

</form>


</div>
</section>

</style>
</div>
</div>
<!-- end of #content-full -->
<script type="text/javascript">
function submitform()
{
code="";
field1 = document.getElementById('uname').value;
field2 = document.getElementById('uemail').value;
field3 = document.getElementById('upass').value;
if(field3=="" && field1=="" && field2==""){
alert("נא למלא שם \n נא להוסיף כתובת מייל תקינה \n נא להוסיף מספר טלפון");
return ;
}
if(field1=="" || field1==null){
alert("נא למלא שם");
return ;
}
if(field2=="" || field2==null){
alert("נא להוסיף כתובת מייל תקינה");
return ;
}
if(field3=="" || field3==null){
alert("נא להוסיף מספר טלפון");
return ;
}


if(field1!="" && field2!="" && field3!=""){
document.myform.submit();
}

}


</script>