Excuse me if regex is outdated/there is a better way of doing this. Right now I have a newsletter code. it basically has someone enter in their email into the input, hit submit and it emails me their email so I can add it to my address book to alert people of new articles. My question is how can I use regex or some sort of verification to make sure they are entering in email into this form? Also, once its submitted, how can I sort of use javascript to eliminate the form entirely and replace it with “Thank you, you have been subscribed” or something of that nature? Here is the code I have so far, first html and then PHP. The site I’m using it on is reesecodes.com
<form method="post" action="scripts/signup.php">
<input name="Email" class="enter-information" type="search" placeholder="Email address" required>
<input type="submit" id="submit" value="SUBSCRIBE" name="Submit">
[code]<?php
$recipient = “ericreese20@gmail.com”;
$subject = “Subscribe”;
$location = “…/index.html”;
$sender = $recipient;
$body .= “Name: “.$_REQUEST[‘Name’].” \n”;
$body .= “Email: “.$_REQUEST[‘Email’].” \n”;
mail( $recipient, $subject, $body, “From: $sender” ) or die (“Mail could not be sent.”);
header( “Location: $location” );
?>[/code]