Manual of PHP

 
 
 

Web map

 
rim   rim
arrowReady frontarrow of Codes PHParrow to Recommend a place using PHP

 

To recommend a place using PHP To print E-mail
Script who threatens a user to visit the web site, route e-mail.

This system allows to the user to send from the web, an e-mail another person, inviting it to visit the place.

Only it needs a module PHP that will be in charge of showing the recommendation form, sending the e-mail and being sick a mailing acknowledgement.

recomendar.php

<! - recommendation form->

<? if ($HTTP_GET_VARS ["action] == "") {
?>

<form method = "post" action = "recomendar.php? accion=enviar" yam = "recommends">
<b> He recommends this place </b> <br> <br>
Your Name: <unputt type = "text" yam = "n_remitente" size = "10"> <br>
Your E-mail: <unputt type = "text" yam = "e_remitente" size = "20"> <br>
Name of your friend: <unputt type = "text" yam = "n_destinatario" size = "10"> <br>
E-mail of your friend: <unputt type = "text" yam = "e_destinatario" size = "20"> <br> <br>
<unputt type = "submit" values = to "Recommend">
</form>

<! - mailing of the form and acknowledgement of mailing or information of errors->
<?
}

elseif ($HTTP_GET_VARS ["action] == to "send") {

//I gather the variables that come from the form

$n_destinatario = $HTTP_POST_VARS ["n_destinatario"];
$e_destinatario = $HTTP_POST_VARS ["e_destinatario"];
$n_remitente = $HTTP_POST_VARS ["n_remitente"];
$e_remitente = $HTTP_POST_VARS ["e_remitente"];

//if the fields are not empty
  if ($n_destinatario! = "" && $e_destinatario! = "" && $n_remitente! = "" && $e_remitente! = "") {

//the url of your place indicates
    $url = "http://www.tusitio.com";
//it indicates the name of your place
    $nombre_del_sitio = "Your Place";
//it indicates the matter of the message
    $asunto = $n_remitente. "he recommends to you a place";
//he writes the message
    $mensaje = "Hello". $n_destinatario. ": <br>";
    $mensaje. = $n_remitente. "he recommends to you to visit <b>". $nombre_del_sitio. "</b>. <br>";
    $mensaje. = "you Can see it in <to href = '". $url. "'>". $url. "</to> <br> <br> Greetings!";

//it indicates that the mail is sent in format HTML

    $encabezado = "From:". $e_remitente. "\nReply-To:". $e_remitente. "\n";
    $encabezado. = "X-Mailer:PHP /". phpversion ()." \n";
    $encabezado. = "Spoil Version: 1.0\n";
    $encabezado. = "Content-Type: text/html";

//he sends the message

    mail ($e_destinatario,$asunto,$mensaje,$encabezado);

//He informs the user who has sent to himself the message

    I begin "<b> The message it has been sent </b>. <br> Thanks for recommending us!";

    }

//if empty fields exist, he sends an error message

    else {

    I begin "Please, it is necessary that you complete all the fields. <br>";
    I begin "<to href ='recomendar.php'> It punctures here </to> to correct the fields.";

    }

}
?>

Eugenia Bahit
http://www.cmzk.com.ar/

 

 
Front
Chapters of the Manual of PHP
Introduction to PHP
Variables
My First Script PHP
Operators in PHP
Structures of Control
Functions in PHP
Code inclusion
Counterfoils (array)
Chains of Characters
Classes
Dates
Entry and Exit
Operations with Files
The language SQL and PHP
Connection with MySQL
Meetings
Forms with PHP
To practise in line
List of practices in line
FAQ
Frequent questions
Codes PHP
List of Codes PHP
Forums
Forums PHP
Other Manuals
Manuals of other languages
 
   
 
 
MySpaceScripts.info - Sitemap - Contact us - Sitemap - Contact us - Sitemap - Contact us

Kiteboards , váhy , grout sealing , plastics , Mehrgenerationenhaus , packaging , Chasse Pologne aux cerfs