Help - Search - Members - Calendar
Full Version: Php Form
Zymic Webmaster Forums > Zymic Free Web Hosting > Databases & MySQL
Walid:)
Hey Guys,

Today i have worked on this Form, using Dreamweaver. This is the address http://huiszoeken.uuuq.com/index3.php.

CODE
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
&lt;script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="saidwalid@hotmail.com">
<table width="34%" border="1" cellpadding="6" bordercolor="#99CC00" bgcolor="#FFFFFF">
<tr>
<td width="27%"><div align="right">
<label for="email">Email:</label>
</div></td>
<td width="73%"><div align="left">
<input name="email" type="text" id="email" size="35" maxlength="90" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="name">Name:</label>
</div></td>
<td><div align="left">
<input name="name" type="text" id="name" size="35" maxlength="80" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="phone">Phone:</label>
</div></td>
<td><div align="left">
<input name="phone" type="text" id="phone" size="35" maxlength="12" />
</div></td>
</tr>
<tr>
<td><div align="right">Budget:</div></td>
<td><div align="left">
<p>
<label>
<input type="radio" name="budget" value="Minder dan 1000" id="budget_0" />
Minder dan 1000</label>
<br />
<label>
<input type="radio" name="budget" value="1000 - 1500" id="budget_1" />
1000 - 1500</label>
<br />
<label>
<input type="radio" name="budget" value="1500 - 2000" id="budget_2" />
1500 - 2000</label>
<br />
<label>
<input type="radio" name="budget" value="2000 - 3000" id="budget_3" />
2000 - 3000</label>
<br />
<label>
<input type="radio" name="budget" value="Meer dan 3000" id="budget_4" />
Meer dan 3000</label>
<br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="comments">Comments:</label>
</div></td>
<td><div align="left">
<textarea name="comments" id="comments" cols="26" rows="5"></textarea>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="clear"></label>
<input type="reset" name="clear" id="clear" value="Reset Form!" />
</div></td>
<td><div align="left">
<label for="submit"></label>
<input name="submit" type="submit" id="submit" onclick="MM_validateForm('email','','RisEmail','name','','R','phone','','RisNum');return document.MM_returnValue" value="Submit E-Mail!" />
</div></td>
</tr>
</table>
</form>
</body>
</html>


Now my question is how to set this up, so my people can send me a mail. So if they press submit, i will get the mail with with the details.. I think i must use phpmyadmin..

It is a project for my school.

Thanks in advance!! Appreciate your help:)
swordz
You need to write a php file to catch all of the data, then mail the data from there. However, for this to work on zymic, you will need to pay $10 to have the mail() function enabled.

The other alternative, is to write a php file and save the data into a database (using phpmyadmin). This is free, but you will have to remember to check the database regularly to see if you have anything there.

swordz
Walid:)
Thanks for your reply!

QUOTE
The other alternative, is to write a php file and save the data into a database (using phpmyadmin). This is free, but you will have to remember to check the database regularly to see if you have anything there.



How can this be done? I have searched the forum, but couldn't find any tutorials. Could you help me with this?

thanks
swordz
If you start it, you'll find people here and on the IRC will help you with problems you come up against.

You need to look at:

$_POST and $_GET variables
Validation/sanitation of variables.
MYSQL

That will certainly get you started. A good general php tutorial is here. The part that deals with forms is here.

swordz
Walid:)
Buddy,

Could you please give the instruction how to do this..The links you gave me, they are only explaining how to make a form. And at the IRC they are only chatting about other things..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.