View Full Version : Best way to send this form?

01-17-2006, 12:14 AM
Hey people well yesterday i posted in the php section with a pre made form but now ive found another one that does the job i want better but it's only in javascript and html anyway here is the page linky (http://trentamd.soc.staffs.ac.uk/student/level_2005/sr910424/1.html)

Now what i want is to send the results to my email address but what language would be best and how would i do it? I though php would be best but... i really dont understand it lol anyway here is the code so far:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>.:Liam Sidley - Student Site:.</title>
<link rel="stylesheet" media="screen" href="style.css" type="text/css" />
<SCRIPT TYPE="text/javascript" src=formval.js>
<div id="whole">
<div id="banner"></div>
<div id="navigation"><a href="index.html" title="Home" target="_self">Home</a> | <a href="about.html" title="About Me" target="_self">About Me</a> | <a href="work.html" title="Work" target="_self">Work</a> | <a href="links.html" title="Links" target="_self">Links</a> | <a href="portfolio.html" title="Portfolio" target="_self">Portfolio</a> </div>

<div id="h2">
<div id="content">
<SCRIPT TYPE="text/javascript">
// Only script specific to this form goes here.
// General-purpose routines are in a separate file.
function validateOnSubmit() {
var elem;
var errs=0;
// execute all element validations in reverse order, so focus gets
// set to the first one in error.
if (!validateEmail (document.forms.demo.email, 'inf_email', true)) errs += 1;
if (!validatePresent(document.forms.demo.from, 'inf_from')) errs += 1;

if (errs>1) alert('There are fields which need correction before sending');
if (errs==1) alert('There is a field which needs correction before sending');

return (errs==0);

<FORM NAME=demo onsubmit="return validateOnSubmit()" action="thanks.html">
<TABLE CLASS=formtab SUMMARY="Demonstration form">

<TD STYLE="width: 10em">
<LABEL FOR=from>Your name:</LABEL></TD>
<TD><INPUT TYPE=text NAME="from" ID="from" SIZE="35" MAXLENGTH="50"
ONCHANGE="validatePresent(this, 'inf_from');"></TD>

<TD id="inf_from">Required</TD>

<TD><LABEL FOR=email>Your e-mail address:</LABEL></TD>

<TD><INPUT TYPE=text NAME="email" ID="email" SIZE="35" MAXLENGTH="50"
ONCHANGE="validateEmail(this, 'inf_email', true);"></TD>
<TD id="inf_email">Required</TD>

<td><label for=subjet>Subject:</label></td>
<td><INPUT TYPE=text NAME="subject" ID="subject" SIZE="35" MAXLENGTH="50"></td>

<td><label for=message>Message:</label></td>
<td><textarea name="message" cols="55" rows="10" wrap="OFF" class="box" id="message"></textarea></td>



<TD><INPUT TYPE="Submit" NAME="Submit" VALUE="Send"></TD>


<div id="copyright">&copy; <a href="mailto:sr910424@staffs.student.ac.uk?Subject=Student Site">Liam Sidley</a> - Staffordshire University Student</div>


01-17-2006, 12:18 AM
If you are able to use php, then I would suggest php. If you don't understand it then learn it. Other server side languages will be hard for you to understand as well since many programming languages have very similar syntax.

01-17-2006, 12:42 AM
ok thanks, what way would be best? a seperate php file saying collect the info from that and send it to me or putting all i have there in the same file and then sending? sorry for sounding dumb

01-17-2006, 12:47 AM
Put the php in the same php file and have the server submit to the same php file.

01-17-2006, 01:42 AM
ok thanks mate ;)