Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

PHP email form [radi bez mysql]

[es] :: PHP :: PHP email form [radi bez mysql]

[ Pregleda: 2663 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

LaMpiR

Član broj: 9930
Poruke: 1343



+2 Profil

icon PHP email form [radi bez mysql]16.01.2004. u 00:51 - pre 246 meseci
Evo za se one koji se muce. Ova skripta ne zahtjeva mysql samo php
Ovo sam ja malo preradio. Original mozete skinuti sa http://www.xentrik.net/php/mailform.php

Code:

<?php

// your name
$recipientname = "LaMpiR";

// your email
$recipientemail = "[email protected]";

// subject of the email sent to you
$subject = "Online-Form Response for $recipientname";

// send an autoresponse to the user?
$autoresponse = "yes";

// subject of autoresponse
$autosubject = "Thank you for your mail!";

// autoresponse message
$automessage = "
This is an auto response to let you know that I've successfully received your email sent to me.
These are you informations:

Name: $name
Nickname: $nickname
Age: $age

Comments: $Comments

-----------------------------

Thanks! I'll get back to you shortly. ";
                                    

// thankyou displayed after the user clicks "submit"
$thanks = "Thank you for contacting me.<br>I will get back to you as soon as possible.<br> ";

// END OF NECESSARY MODIFICATIONS

?>

<style type="text/css"><!--
td, body, input, textarea {
    font-size:12px;
    font-family:Verdana,Arial,Helvetica,sans-serif;
    color:#000000}
--></style>


</HEAD>
<body>

<table width="100%" height="100%"><tr>
<td valign="top"><font face="Verdana,Arial,Helvetica" size="2">

<?php
if($submitform) {

$name = $HTTP_POST_VARS['name'];
$nickname = $HTTP_POST_VARS['nickname'];
$email = $HTTP_POST_VARS['email'];
$age = $HTTP_POST_VARS['age'];
$comments = $HTTP_POST_VARS['comments'];
$date = $getdate = date('g:i:s a - d, M Y ');



// check required fields
$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<br>";
}
}

// check email address
if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[[email protected]]+$", $Email))){
$error .= "Invalid email address<br>";}



// display errors
if($error) {
?>

<b>Error</b><br>
<?php echo $error; ?><br>
<a href="#" onClick="history.go(-1)">try again</a>


<?php
}
else 
{

$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR;

// format message
$message = "Online-Form Response for $recipientname:

Name: $Name
Nickname: $nickname
Email: $Email
Age: $age
Date: $date\n

Comments: $Comments

-----------------------------

Browser: $browser

User IP: $ip";

// send mail and print success message
$hurrah = mail($toemail,"$subject","$message","From: $Name <$Email>");
if($hurrah) {
if($autoresponse == "yes") {
$autosubject = stripslashes($autosubject);
$automessage = stripslashes($automessage);
mail($Email,"$autosubject","$automessage","From: $recipientname <$recipientemail>");
}
echo "$thanks";
}
}

else {
?>

<form name="contactform" action="<?php echo $PHP_SELF; ?>" method="post">
<input type="hidden" name="toemail" value="<?php echo $recipientemail; ?>">
<input type="hidden" name="toname" value="<?php echo $recipientname; ?>">
<input type="hidden" name="require" value="Name,Email,Comments">
<table><tr> 
<td colspan="2" align="center"><b>Contact Me!</b><p></td>
</tr><tr> 
<td valign="top" align="right">Name:</td>
<td valign="top"><input name="Name" size="25"></td>
</tr><tr>
<td valign="top" align="right">Nickname:</td>
<td valign="top"><input name="nickname" size="25"></td>
</tr><tr> 
<td valign="top" align="right">E-mail:</td>
<td valign="top"><input name="Email" size="25"></td>
</tr><tr>
<td valign="top" align="right">Age:</td>
<td valign="top"><input name="age" size="25"></td>
</tr><tr>  
<td valign="top" align="right">Comments:</td>
<td valign="top"><textarea name="Comments" rows="5" cols="35"></textarea></td>
</tr><tr> 
<td colspan="2" align="center"><input type="submit" value="Submit" name="submitform">
<input type="reset" value="Reset" name="reset"></td>
</tr></table>
<br>

</form>
<?php } ?>
</font><p></td>
</tr><tr>
<td valign="bottom"><font face="Verdana" size="1">Mailform Copyright © 2002 <a href="http://www.xentrik.net/">Kali's Web Shoppe</a>.</font></td>
</tr></table>

</body>


 
Odgovor na temu

bluesman

Član broj: 4505
Poruke: 1895
*.33.EUnet.yu



+1 Profil

icon Re: PHP email form [radi bez mysql]16.01.2004. u 01:34 - pre 246 meseci
Ok, mada ne znam zašto bi uopšte formmail imao bilo kakve veze sa mysql?
Goran Pilipović fka bluesman
 
Odgovor na temu

LaMpiR

Član broj: 9930
Poruke: 1343



+2 Profil

icon Re: PHP email form [radi bez mysql]16.01.2004. u 11:03 - pre 246 meseci
pa vecinu mailformova koje sam ja naso bili su php+mysql
 
Odgovor na temu

bOkIcA
Bojan Abramovic
Novi Sad

Član broj: 1808
Poruke: 520
*.metrohive.net

Sajt: www.bokica.com


Profil

icon Re: PHP email form [radi bez mysql]16.01.2004. u 11:48 - pre 246 meseci
mailform == form to mail == tj. sadrzaj forme se salje mailom iliti na mail
kapish
no mysql, no database

 
Odgovor na temu

bluesman

Član broj: 4505
Poruke: 1895
*.187.EUnet.yu



+1 Profil

icon Re: PHP email form [radi bez mysql]16.01.2004. u 12:39 - pre 246 meseci
Sadrzaj koji posetilac unese u formularu se salje na e-mail koji unese - nema veze sa bazom podataka, samo manipulacija sa varijablama i prosledjivanje na mail()

Jedini slucaj kada se koristi baza je kada citas adrese primaoca iz baze (znaci neki sistem gde treba biti ulogovan ili neka mailing lista... newsletter...) za obican formmail nije potrebno.
Goran Pilipović fka bluesman
 
Odgovor na temu

LaMpiR

Član broj: 9930
Poruke: 1343



+2 Profil

icon Re: PHP email form [radi bez mysql]16.01.2004. u 13:07 - pre 246 meseci
pa nisam znao da radi bez mysql ali dobro.
 
Odgovor na temu

[es] :: PHP :: PHP email form [radi bez mysql]

[ Pregleda: 2663 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.