Ben bir abone formu kaydolmak içeren bir açılır pencere var. Kullanıcı tıkladığında istiyorum abone olduktan sonra form kaldırılır ve bir teşekkür mesajı göstermelidir. Bütün bu php kullanarak çalıştırmak gerekiyor.
Aşağıda ben bugüne kadar ne var, ama 'subscribeSubmit' değişken ayarlanmış olduğundan açılır tekrar form doğrulama hataları gösterir abone düğmesine tıklayarak zaman kadar kalmak ve değildir.
Peki, nasıl açık açılan tutmak ve karşılama mesajı ile formunu değiştirmek?
Lütfen yardım edin, teşekkürler!
<?php
if(isset($_POST['subscribeSubmit'])){
unset($error); //errasing error variable
//**************finding errors in form*******************
if(strlen($_POST['Fname']) <= 0) {$error[] = "Your name is required.";}
if(!eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,6}$", stripslashes(trim($_POST['emailPopin'])))) {$error[] = "Your e-mail address is not valid.";}
if(strlen($_POST['emailPopin']) <= 5) {$error[] = "You have to enter at least one e-mail to subscribe.";}
if(strlen($_POST['industry']) <= 0) {$error[] = "Your industry is required.";}
if(strlen($_POST['country']) <= 0) {$error[] = "Your country is required.";}
if(strlen($_POST['zip']) <= 0) {$error[] = "Your zip is required.";}
//************if there is an error**********
if(sizeof($error) > 0)
{
report_errors($error);
subscribe_form();
}
//**********if there is no error, we can subscribe them******
else
{
//**********Reduce First Name to 30 characters and replace special characters******
$name = substr($_POST['Fname'], 0, 30);
//***** Replaces special characters ******
$name = special_letters($name);
//**********write to data file******
//Left out on purpose
//**********Display thank you message******
echo '<p>Thanks for signing up!<br/><a href="#" onClick="window.location.href=window.location.href">Click here to sign up friends.</a></p>';
}
}
else
{
$Fname = $_POST["Fname"];
$email = $_POST["emailPopin"];
$leader = $_POST["radiobuttonTeamLeader"];
$industry = $_POST["industry"];
$country = $_POST["country"];
$zip = $_POST["zip"];
echo '<form action="" method="post" enctype="multipart/form-data" style="background:#efefef;">';
echo '<div style="text-align:left;background:#efefef;padding-bottom:4px;"><p style="line-height:20px; font-size:12px;">Fill in the form below to signup for our free daily newsletter. All fields are Necessary.( <span class="required">*</span> ).</p><table id="popupSubscribe-form">';
echo '<tr><td class="label"><label for="name">First Name: <span class="required">*</span></label></td><td><input type="text" name="f_name" size="30" value=""></td></tr>';
echo '<tr><td class="label"><label for="email">Email: <span class="required">*</span></label></td><td><input type="text" size="30" id="emailPopin" value=""></td></tr>';
echo '<tr><td class="label"><label for="email">I Lead A Team: <span class="required">*</span></label></td>';
echo '<td><table><tr><td><input type="radio" value="yes" name="radiobuttonTeamLeader" style="width:15px;"><strong style="margin: 0 15px 0 5px;">Yes</strong></td>';
echo '<td><input type="radio" value="no" name="radiobuttonTeamLeader" style="width:15px;"><strong style="margin: 0 15px 0 5px;">No</strong></td></tr></table></td>';
echo '<tr><td class="label"><label for="industry">Industry: <span class="required">*</span></label></td><td><input type="text" name="industry" size="30" value=""></td></tr>';
echo '<tr><td class="label"><label for="country">Country <span class="required">*</span></label></td>';
echo '<td><select size="1" class="countryDropDown" name="country">';
echo '<option value="us" selected="selected">United States</option>';
echo '<option value="ca" >Canada</option>';
echo '</select></td></tr>';
echo '<tr><td class="label"><label for="email">Zip Code: <span class="required">*</span></label></td><td><input type="text" name="zip" size="30" value=""></td></tr>';
echo '<tr><td></td><td><input type="submit" id="subscribeSubmit" value="" name="subscribeSubmit"/></td></tr></table></div>';
echo '</form>';
}
}