/    Sign up×
Community /Pin to ProfileBookmark

php form processing in ssi will this work

Hello

I have shtml page which is feedback page, i have done most it with html form tags and using java script.

however i want to process the form i.e. send the data to an email address in the form tag.

here ->
<FORM ACTION=”form_process.php” METHOD=”POST” ENCTYPE=”application/x-www-form-urlencoded” NAME=”test” ID=”ENQUIRY”>

so if i made a php script like the one below and alled it form_process.php will this work?
<?
$sendform = false;
if(isset($_POST[‘Submit’])){
while(list($key,$val) = each($_
POST)){
$$key = $val;
if($val!=”) $sendform = true;
}
if((!eregi(“^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$”, $email)) || (strlen($msg)<2)){
echo “<span class=”newstime”>Invalid email address and message can’t be empty!</span>”;
}
else if($sendform==true) {
$headers = “From: “.$name.”<“.$email.”>nReply-To: “.$email;
$recipientName = “Admin”;
$recipient = “[email protected]“;

$message =”From : $namen”;
$message .=”Phone : $phonen”;
$message .=”Comment : $msgn”;

$subjectPrefix = ” Website Enquiry”;
$headersResp = “From: “.$recipientName.”<“.$recipient.”>nReply-

$issent = mail($recipient, $subject, $message, $headers);

if(isset($issent)) echo “<span class=”newstime”>Thank you for your message!</span>”;
} else echo “<span class=”newstime”>All fields must be filled in. Unable to send form.</span>”;

}
?>

thanks your advice people much appreciated.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJun 29.2005 — yes you can handle data on the same page, but you will still need input areas (i dont see them) a closing form tag and a submit button. When hitting this button, the page will be "read" again, and the information can be parsed instead of displaying the form
×

Success!

Help @morkz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...