Note that there are some explanatory texts on larger screens.

plurals
  1. POEchoing not leaving the page
    primarykey
    data
    text
    <p>I have a simple subscribe to newsletter form on my website. And I wanted you to help me make it more userfriendly. what my form can not do: -it can't Echo "success" "not success" NOT leaving the page(it shows status in a new page, which is frustrating) -it can not validate correct and incorrect emails(if you put in some rubbish, I will receive it anyway)</p> <p>these are the main problems of my form. Will you please direct me to some useful tuts, or just correct my codes. Any help will be appreciated!</p> <p>HTML:</p> <pre><code>&lt;div class="subscribe"&gt; &lt;form method="POST" action="subscribe.php"&gt; &lt;p&gt;&lt;input type="text" name="Name" size="24" maxlength="40" style="font-family:'Times New Roman', Times, serif" value="Ваше имя" onfocus="if (this.value == 'Ваше имя') {this.value = '';}" onblur="if (this.value == '') {this.value ='Ваше имя';}"&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="text" name="Email" size="24" maxlength="40" style="font-family:'Times New Roman', Times, serif" value="Ваш email" onfocus="if (this.value == 'Ваш email') {this.value = '';}" onblur="if (this.value == '') {this.value ='Ваш email';}"&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="image" value="submit" name="Submit" src="images/subscribe.png"&gt;&lt;/p&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>PHP:</p> <pre><code>&lt;?php $recipient = "order@dastiche.kz"; $subject = "Subscriber"; $name = $_POST['Name']; $email = $_POST['Email']; $location = "index.html"; $sender = $recipient; $body .= "Name: ".$_REQUEST['Name']." \n"; $body .= "Email: ".$_REQUEST['Email']." \n"; if (($name != "") or ($email != "")) // Если существуют проверяем... { if ((strlen($name) &gt;= 2) and (strlen($name) &lt;= 25)) { $name = stripslashes($name); $name = html_entity_decode($name); $name = strip_tags($name); } else { echo " something is wrong with name field "; echo "&lt;center&gt;&lt;input name='back' type='button' value='get back' onclick= 'javascript:history.back()'&gt;&lt;/center&gt;"; } if (eregi("^[._a-zA-Z0-9-]+@[.a-zA-Z0-9-]+.[a-z]{2,6}$", $email)) { $email = stripslashes($email); $email = htmlspecialchars($email); $email = strip_tags($email); } else { echo "There are some mistakes in the \"E-mail\" field"; echo "&lt;center&gt;&lt;input name='back' type='button' value='try again' onclick= 'javascript:history.back()'&gt;&lt;/center&gt;"; } } // Если не существуют выводим сообщение... else { echo "Please, fill in blanks"; echo "&lt;center&gt;&lt;input name='back' type='button' value='try again' onclick= 'javascript:history.back()'&gt;&lt;/center&gt;"; } if (($name) and ($email)) { echo "thanks for subscription!"; } mail( $recipient, $subject, $body, "From: $sender" ) or die ("Mail could not be sent."); header( "Location: $location" ); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload