form php

Secţiune dedicată începatorilor.

Moderatori: Moderatori, Start Moderator

eddycomeback
New Member
Mesaje: 1
Membru din: Lun Noi 25, 2013 6:06 pm

form php

Mesajde eddycomeback » Lun Noi 25, 2013 6:13 pm

buna ziua dragi developers, am si eu o intrebare simpla pentru cei mai inraiti php maker.

Cum sa adaug la acest form dupa ce a fost trimis formul un mesaj, '''MESAJUL A FOST TRIMIS'

Acesta este codul din situl meu

<form action="mailer.php" method="post" name="form1" id="form1" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">

<label>Nume:</label>
<input name="name" class="span7" type="text" id="name" value=""/>
<label>Telefon:</label>
<input name="telefon" class="span7" type="text" id="telefon" value=""/>
<label>Email:</label>
<input name="from" class="span7" type="text" id="from" value=""/>
<label>Cod de verificare:</label>
<input name="verif_box" class="span2" type="text" id="verif_box" />
<img src="verificationimage.php?4231" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
<br />

<!-- if the variable "wrong_code" is sent from previous page then display the error field -->

<label>Mesaj:</label>
<textarea name="message" class="span10" cols="30" rows="8" id="message" ></textarea>
<p><input name="Submit" class="btn-u" type="submit" value="Trimite"/></p>
</form>

<form action="mailer.php" method="post" name="form1" id="form1" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">

<label>Nume:</label>
<input name="name" class="span7" type="text" id="name" value="<?php echo $_GET['name'];?>"/>
<label>Telefon:</label>
<input name="telefon" class="span7" type="text" id="telefon" value="<?php echo $_GET['telefon'];?>"/>
<label>Email:</label>
<input name="from" class="span7" type="text" id="from" value="<?php echo $_GET['from'];?>"/>
<label>Cod de verificare:</label>
<input name="verif_box" class="span2" type="text" id="verif_box" />
<img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
<br />

<!-- if the variable "wrong_code" is sent from previous page then display the error field -->
<?php if(isset($_GET['wrong_code'])){?>
<div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div><br />
<?php ;}?>

<label>Mesaj:</label>
<textarea name="message" class="span10" cols="30" rows="8" id="message" ><?php echo $_GET['message'];?></textarea>
<p><input name="Submit" class="btn-u" type="submit" value="Trimite"/></p>
</form>

<?php
// load the variables form address bar
$name = $_REQUEST["name"];
$telefon = $_REQUEST["telefon"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];

// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name);
$telefon = stripslashes($telefon);
$message = stripslashes($message);
$subject = stripslashes($subject);
$from = stripslashes($from);

// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
// if verification code was correct send the message and show this page
$message = "Nume: ".$name."\n".$message;
$message = "Telefon: ".$telefon."\n".$message;
$message = "Email: ".$from."\n".$message;
mail("email@gmail.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
} else {
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}

?>



Avatar utilizator
virus
Average Member
Mesaje: 153
Membru din: Dum Feb 27, 2011 3:16 pm
Localitate: Timisoara
Contact:

Re: form php

Mesajde virus » Lun Noi 25, 2013 8:59 pm

echo ($busy === TRUE) ? "F**k Off" : "Hello. Can I help You?" ;


Înapoi la “PHP Incepători”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 25 vizitatori