Validation with better LINK facility

the mail() function

Moderators: macek, egami, gesf

Webiter
New php-forum User
New php-forum User
Posts: 4
Joined: Mon Jan 02, 2012 2:25 pm
Location: Rep of Ireland
Contact:

Validation with better LINK facility

Postby Webiter » Thu Jan 05, 2012 1:11 pm

Restyled the query.
At this test location http://www.postbox.webitry.net/subscribe.html I have installed server side validation in addition to the javascript that I have working on the form processor.

The process_sub.php code is as presented below. At the end of the //WRITE VALIDATED EMAIL TO LIST code snippet there is a bit of html which presents at the end of the process and enables the visitor return to a webpage!

Is there any WAY that I a similar bit of html introduced at the end of the //VALIDATE THE SUBMITTED EMAIL that could facilitate the introducrion of a link back to the Subscribe form ?

Code: Select all

<html><head>
<title>Write Sub to List....</title>
</head><body>
<br />
<?php

$List = $_POST['List'];
$Email = $_POST['Email'];

//VALIDATE THE SUBMITTED EMAIL
$email = htmlspecialchars($_POST['Email']);
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$Email)) {
die("Please enter a valid email address....!<br /><br />Use the Go Back Button to return to the SUBMIT EMAIL Form");
}

>>>>>>>>>>>Bit of html to support a link back to the form<<<<<<<<<<<<...???????

//WRITE VALIDATED EMAIL TO LIST
if (file_exists("data/$List")) {
$myfile = file("data/$List");
$fh = fopen("data/$List", "w");
for ($index = 0; $index < count($myfile); $index++) {
if ($Email != rtrim($myfile[$index])) {
fputs($fh, $myfile[$index]);
}
}
fputs($fh, $Email . "\n");
fclose($fh);
} else {
$myfile = fopen("data/$List", "w");
fputs($myfile, $Email . "\n");
fclose($myfile);
}

?>

<br><br>
            Thank you for subscribing to our E-mail List!
<br><br>
           <a href="index.php">Back to Home Page</a>.
</body></html>


Thanks in Advance for any help.

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Validation with better LINK facility

Postby egami » Tue Jan 10, 2012 5:37 pm

<a href="#" onClick="history.go(-1)">Back</a>

Webiter
New php-forum User
New php-forum User
Posts: 4
Joined: Mon Jan 02, 2012 2:25 pm
Location: Rep of Ireland
Contact:

Re: Validation with better LINK facility

Postby Webiter » Wed Jan 11, 2012 4:14 am

Many thanks and much appreciated.


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron