Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Lock down a form

An AmericanAn American Posts: 2Member
I have a tell a friend page done in PHP adnd I'd like to have it so that they can't edit/change the message only add their email & friend email...and not be able to add spam to it.

and I'm pretty new at PHP so Thanks in advance for any help!

here's the code I'm using for the Tell a Friend
<?php

$FriendName = $_POST['FriendName'];
$FriendEmail = $_POST['FriendEmail'];
$Name = $_POST['Name'];
$Email = $_POST['Email'];
$emailtext = $_POST['emailtext'];
$string = "http://www.americanconsumerinstitute.org";

?>






<?php
if (!$FriendEmail) {
?>

































    Name: E-mail:
You:  





Friend:  







Message:  


I found this great website and I believe you would be interested in it.
Here is the link to that page: <?php echo $string ?>

   



 


<?php
}
else {
if ($FriendEmail) { mail( $FriendEmail, "Message from $Name", "$FriendName,

".$emailtext ."

$Name", "From: $Email");

}


echo "<center>

Thank you $Name. The email has been sent to $FriendName.

Close this window


powered by: Tell A Friend

";
}
?>

 



Comments

  • bmjcpobmjcpo Posts: 18Member
    : I have a tell a friend page done in PHP adnd I'd like to have it so that they can't edit/change the message only add their email & friend email...and not be able to add spam to it.
    :
    : and I'm pretty new at PHP so Thanks in advance for any help!
    :
    : here's the code I'm using for the Tell a Friend
    : <?php
    :
    : $FriendName = $_POST['FriendName'];
    : $FriendEmail = $_POST['FriendEmail'];
    : $Name = $_POST['Name'];
    : $Email = $_POST['Email'];
    : $emailtext = $_POST['emailtext'];
    : $string = "http://www.americanconsumerinstitute.org";
    :
    : ?>
    :
    :
    :
    :
    :
    :
    : <?php
    : if (!$FriendEmail) {
    : ?>
    :
    :
    :

    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
      Name: E-mail:
    You: 
    :
    :

    :

    :
    :

    :
    Friend: 
    :
    :
    :

    :

    :
    :
    :

    :
    Message: 
    :
    :
    : I found this great website and I believe you would be interested in it.
    : Here is the link to that page: <?php echo $string ?>
    :

    :
      
    :
    :
    :

    :
     
    :

    :
    : <?php
    : }
    : else {
    : if ($FriendEmail) { mail( $FriendEmail, "Message from $Name", "$FriendName,

    ".$emailtext ."

    $Name", "From: $Email");
    :
    : }
    :
    :
    : echo "<center>Thank you $Name. The email has been sent to $FriendName. Close this window


    : powered by: Tell A Friend

    ";
    : }
    : ?>
    :

     

    :
    :
    :
    :
    ---------
    What I understand from what you're asking, is that you want to lock a textarea from being editted.
    Why so difficult?
    I should just show the message like a label, and just put the email-message in a variable. So without working with a textarea:

    [code]
    $friendEmail = $_POST['FriendEmail'];
    $friendName = $_POST['FriendName'];
    $name = $_POST['FriendName'];
    $email = $_POST['Email'];
    $stringWebAddress = "http://www.americanconsumerinstitute.org";
    $emailMessage = "I found this great website and I believe you would be interested in it. Here is the link to that page:".$stringWebAddress

    /*left out code*/

    //include this in your form:





    I found this great website and I believe you would be interested in it. Here is the link to that page:<?php $stringWebAddress ?>
    //+submit button

    /*left out code*/

    if (isSet($friendEmail)) {
    mail( $friendEmail, "Message from $name", "$friendName,

    ".$emailMessage ."

    $name", "From: $email");
    }
    [/code]
    This way, you work around the problem with locking a textarea. Just use strings without giving the opportunity to edit that field.
Sign In or Register to comment.