Form Script

TimMorgan's picture

They have: 14 posts

Joined: Feb 2006

Hi,

I need help with making a script so people can send mail through my website as ive never actually needed to use it before as i usually just have a mailto link.

Well basically look at my site:

www.makememysite.co.uk

And you can see the form on the right. Basically I need all the code to set it up.
Don't suppose if someone could sort the code out for me for that exact form having a name, email/phone, message box with the GO! graphic as submit.

This is the location of the GO! graphic if you need it: http://www.gadgetplay.co.uk/site/img/go.jpg

I also have formmail.pl in my cgi-bin, dunno if this might help.

If someone can help me then id happily plug your website from mine (if you have one)

Thanks

demonhale's picture

He has: 3,278 posts

Joined: May 2005

theres a bunch of formmail scripts you could customize... php is a great way to do this...
Go to hotscripts.com if you cant find anything you want there then feel free to ask again...

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Here's the one I use

<?php
/*****************************************************************/
/* Program Name         : SmE Form                               */
/* Program Version      : 1.0                                    */
/* Program Author       : Estevan Simonyi                        */
/* Site                 : <a href="http://www.scriptme.com" class="bb-url">http://www.scriptme.com</a>                */
/* Email                : <a href="mailto:[email protected]" class="bb-email">[email protected]</a>                  */
/*                                                               */
/* Copyright (c) 2004 Scriptme.com All rights reserved.          */
/* Do NOT remove any of the copyright notices in the script.     */
/* This script can not be distributed or resold by anyone else   */
/* than the author, unless special permisson is given.           */
/*                                                               */
/*****************************************************************/
/*********************************************************************************
*       Filename: sme_form.php
*********************************************************************************/
// change the variables bellow
// Your email here
$email1 = "[email protected]";

// Contact formname
$sme_form_c = "Contact form from hippies";

// your site URL
$homepageurl = "http://www.hsasda.net";

// automatic message send to user send email
$tnk = "We received your email. Your joke will be reviewed and posted soon!";
// not change more anything
// not change more anything
// not change more anything
// not change more anything
// not change more anything
// not change more anything
?>

&lt;script Language="JavaScript"&gt;
<!--
function checa_formulario(form){
if (form.Name.value == ""){
alert("Please your name!");
form.Name.focus();
return (false);
}
if (form.sub.value == ""){
alert("Please Message Subject!");
form.sub.focus();
return (false);
}
if (form.Message.value == ""){
alert("Please your Message!");
form.Message.focus();
return (false);
}
if (form.Email.value.indexOf('@', 0) == -1){
alert("Please your E-mail!");
form.Email.focus();
return (false);

}
return (true);
}
//-->
&lt;/script&gt;<body bgcolor="#EFEFEF">
<form  method="post" action="" name='form'  onSubmit='return checa_formulario(this)'>
  <?php                  
$date
= date("m/d/Y H:i:s");
if (!
$_POST['sme_form']) { ?>

  <table width="70%" border="0" align="center" cellpadding="1" cellspacing="1">
    <tr bgcolor="#EFEFEF">
      <td width="30%"> <div align="center"><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2>*Your Name:</FONT></div></td>
      <td width="70%" > <input type="text" name="Name" size="40">
      </td>
    </tr>
    <tr bgcolor="#EFEFEF">
      <td width="30%"> <div align="center"><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2>*Your Email:</FONT></div></td>
      <td width="70%" > <input type="text" name="Email" size="40">
      </td>
    </tr>
    <tr bgcolor="#EFEFEF">
      <td width="30%"  ><div align="center"><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2>*Message Subject:</FONT></div></td>
      <td width="70%"><input name="sub" type="text" value="Joke"  size="40">
      </td>
    </tr>
    <tr bgcolor="#EFEFEF">
      <td width="30%" ><div align="center"><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2>*Joke</FONT></div></td>
      <td width="70%"><textarea name="Message" cols="40" rows="5" ></textarea>
        <br>
      </td>
    </tr>
    <tr bgcolor="#EFEFEF">
      <td width="30%" nowrap><input type="hidden" name="sme_form" value="1"></td>
      <td width="70%"><input type="submit"  value="Submit"  name="submit">
      </td>
    </tr>
  </table>
</form>
<?php }

else
{
    echo
"<table width=100%><tr>
    Thanks for contact us :
$_POST[Name]!
    <br><br>We contact your in email : <b>
$_POST[Email]
    </tr></table></center>"
;
       
mail("$email1", "$sme_form_c","
Message sent in
$date
--------------------------------------------------------

Name    :    
$_POST[Name]
Email    :   
$_POST[Email]
Subject :   
$_POST[sub]
Message :  
$_POST[Message]
--------------------------------------------------------
\n\n
"
,"From: $_POST[Email]");

mail("$_POST[Email]","$homepageurl ", " $Name\n
---------------------------------------------\n
Dear:
$_POST[Nome]\n
$tnk \n
---------------------------------------------\n
\n
\n\n"
,"From: $email1");
}
?>
'

Enjoy Laughing out loud

TimMorgan's picture

They have: 14 posts

Joined: Feb 2006

Can i insert php into a html page then?

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

You will just have to change the filename from something.html to something.php, it will not do anything to the html, just makes that form work. You host supports PHP right?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.