Jump to content

Dynamic contact form


barney0o0

Recommended Posts

Ill make my excuses now, but i just dont know what to do with this.....

Does anyone have a script/link for a simple (and safe) contact form to mail that i could use that would allow me to add a dynamic email address to the mailto: function or similar.

Im building a website at the moment and through there are hyperlinked contacts (via database usersIDs) that i would like to send to a standard form and then populated by the usersID email (however hidden from view).

Ive seen a nice form from [a href=\"http://www.dagondesign.com/articles/secure-php-form-mailer-script/\" target=\"_blank\"]Dragon Design[/a] and the php file uses [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$recipients = "onerecip|user@domain.com";[/quote]...is it posible to change to passed varible?

Many thanks in advance
Link to comment
Share on other sites

[INDEX.PHP]


<p>Feedback</p>
<form action="mail.php" method="post">

<p>Your Name </p>
<input class="email" type="text" name="name">
<br>
<br>

Your E-mail
<input class="email" " type="text" name= "email" size="20">
<br>
<br>

Comments<br>
<textarea name="comments" class="email"></textarea>
<br>
<br>

<input class="submit" type="submit" value="Submit Information">

</form>

-------------------------------------------------------
Mail.php


<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}

$name=$_POST['name'];
checkOK($name);
$email=$_POST['email'];
checkOK($email);
$comments=$_POST['comments'];
checkOK($comments);
$to="EMAIL ADDRESS SENT TO";
$message="$name just sent a comment. They said:\n$comments\n\n Their e-mail address is: $email";
if(mail($to,"Comments!!!",$message,"From: $email\n")) {
echo ("Thank you very much for your support");
echo '"> Click here to go back </a>';
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly :), Thanks";
}
?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.