Forum Moderators: coopster

Message Too Old, No Replies

php contact form

php contact form

         

meanweaver

6:49 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



I am trying to make a contact form work which is a free script from free-php.net I have managed to get the includes to now work but seem to have some script on the output now, its the line starting with this
if ($_SERVER['REQUEST_METHOD'] == "POST ect ect.

This script does not seem to easy for a bigineer like me to get the hang of, does anyone know of any easier contact form to get to grips with, My existing one works on frontpage extensions but would like to advance a bit further now and use a php form.

Regards Ian

kumarsena

8:02 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



hey,

im using a script that i found from hotscript.com called mmex. it was easy enough to set up, u can look for it yourself or stiicky me ur email and i will send the files to you.(dont think i can do attachment with sticky mail)

bumpaw

10:05 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



Try going to hotscripts.com and just download several that look good and seem to be user friendly. Then compare the documentation for the age of the code and amount of explanation. Check the developers website to see if it has been abandoned or updated. I just completed this process and settled on JaxNewsletter. It helps to have a good host with great support,to help with the occasional install problem. I'm fairly new to PHP myself.

meanweaver

12:31 am on Mar 16, 2004 (gmt 0)

10+ Year Member



I seem to need help with mmex that i got from hotscripts. The readme file is information overload for a beginner like me, If anyone uses this script wonder if they could please tell me the in idiot proof terms the least i have to do to make this thing work. I have uploaded all the files renamed that .std file to the same name as my form.html but left the .std extension on it, and changed the <form action>= to point to the mmex.php ect ect, someone please help!

Regards Ian

jastog

11:29 am on Mar 18, 2004 (gmt 0)

10+ Year Member



#form data simple HTML - START

<form name="form1" enctype="multipart/form-data" method="post" action="/isprati.php">
<table width="792" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="1">&nbsp;</td>
<td colspan="4"><blockquote>
<p align="justify">After filling the form bellow, if you choose<strong> complete
documentation</strong>, our employee will contact you and deliver complete documentation.
If you choose any other option we will answer your requests as soon as
possible.</p>
</blockquote> </td>
<td width="12">&nbsp;</td>
</tr>
<tr align="center">
<td><div align="left"></div></td>
<td width="351"><div align="right">Reason for contact: </div></td>
<td width="10">&nbsp;</td>
<td width="192">
<div align="left">
<select name="izbor" size="1" id="izbor">
<option></option>
<option>information</option>
<option>complete documentation</option>
<option>Website</option>
<option>Other</option>
</select>
<font color="#FF0000">*</font></div></td>
<td width="226">&nbsp;</td>
<td><div align="center"></div></td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">Name:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="ime" type="text" id="ime">
<font color="#FF0000">*</font></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">Surname:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="prezime" type="text" id="prezime">
<font color="#FF0000">*</font></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">Name of faculty/clloge/institution:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="organizacija" type="text" id="organizacija">
<font color="#FF0000">*</font></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">email:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="email" type="text" id="email">
<font color="#FF0000">*</font></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">organization email:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="emailorg" type="text" id="emailorg">
</div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">Website:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="site" type="text" id="site">
</div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">tel.:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="tel" type="text" id="tel">
<font color="#FF0000">*</font></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">fax:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="faks" type="text" id="faks">
<font color="#FF0000">*</font></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">Country:</div></td>
<td>&nbsp;</td>
<td><div align="left">
<input name="zemja" type="text" id="zemja">
<font color="#FF0000">*</font></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2"><div align="left">
<textarea name="komentar" rows="5" id="komentar"></textarea>
</div></td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td><div align="right">
Fields marked with <font color="#FF0000">*</font> are requaired
<input name="isprati" type="submit" id="isprati" value="Submit">
</div></td>
<td>&nbsp;</td>
<td colspan="2"><div align="left">
<input name="izbrisi" type="reset" id="izbrisi" value="Reset">
</div></td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
<td colspan="4">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>

#form data simple HTML - END

This form you can put in any HTML file, and is used to collect some conatct informations about visitor etc..
action="/isprati.php" will send all colected informations to "isprati.php" separate file. (if you rename this file to send.php, make same rename to form under action. Extualy, if you are new, every form is associate with some action, in this case it POST-s data to some file.
Now we need this file "isprati.php" to DO something with colected and posted data. You will notice thata with "@extract($_POST);" we are extracting all posted data to this file to variables with same names (with "$" in front the name).

Here is isprati.php:

#Start HERE ------

<?php
@extract($_POST);
$foo = "foo@foo.com";
$foo1 = "foo1@foo1.com";
$izbor = stripslashes($izbor);
$izbor .= "+$zemja";
$ime = stripslashes($ime);
$prezime = stripslashes($prezime);
$organizacija = stripslashes($organizacija);
if ($emailorg == "") {$emailorg = "Ne ostavil\n";};
$poraka = "Ime: $ime\n\n";
$poraka .= "Prezime: $prezime\n\n";
$poraka .= "Organizacija: $organizacija\n\n";
$poraka .= "Licen email: $email\n\n";
$poraka .= "Email na organizacija: $emailorg\n\n";
$poraka .= "Web strana: $site\n\n";
$poraka .= "Telefon: $tel\n\n";
$poraka .= "Faks: $faks\n\n";
$poraka .= "Zemja: $zemja\n\n";
$poraka .= "Poraka: $komentar\n\n\n\n\n\n";
$vreme = date("d-m-Y H:i");
$ip = $REMOTE_ADDR;
$poraka .= "time: $vreme\n";
$poraka .= "IP: $ip\n";
$from = "From: $ime <$email>\n";
mail($foo,$izbor,$poraka,$from);
mail ($foo1,$izbor,$poraka, "From :$email\n Reply-To:$email\n");
echo "<center><b>".$ime." </b>Vasite podatoci se uspesno isprateni / Your data are sent"
."<table width=100% border=0 cellspacing=0 cellpadding=0>"
."<tr><td width=10%>&nbsp;</td>"
."<td width=80%>Pocituvan(a) <b>".$ime."</b>, blagodarime za vasiot interes.</td>"
."<td width=10%>&nbsp;</td>"
." </tr> <tr> <td width=10%>&nbsp;</td>"
."<td width=80%>Dear <b>".$ime."</b>, Thank you for your interest. Our team will conatct you as soon as possible</td>"
. "<td width=10%>&nbsp;</td>"
."</tr></table>";
?>

#End HERE

As you can see this file will send colected data to 2 emails foo@foo.com and foo1@foo.com, and diplay some Thank you message. It also send remot IP and time of submiting.
You are free to use, modifay or whatever you want to do with this script.