Jill Sandwich
the turds of Optimus Prime
I've bitten off more than I can chew telling my friend I can make an iPhone-like form for his website. I used iWebkit for the framework, and setting up the form was easy. What I didn't think about was to make that data usable. I've tried writing a PHP script to send the form elements as an email, but it isn't working, probably because it's my first time writing anything in PHP. Can anyone out there help?
The form:
The PHP file. I'm only taking the 'name' form field so far. If I can get one field working, then the rest will follow.
:
The form:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="css/style.css" rel="stylesheet" media="screen" type="text/css" />
<script src="javascript/functions.js" type="text/javascript"></script>
<title>Client Details</title>
<meta content="fitness,training,company" name="keywords" />
<meta content="Sign up and assessment" name="description" />
</head>
<body>
<div id="topbar" class="black"><div id="title">The FTC</div></div>
<div id="content">
<form name="input" action="ftcform.php" method="post">
<span class="graytitle">Client Details</span>
<ul class="pageitem">
<li class="bigfield"><input placeholder="Name" name="name" type="text" /></li>
<li class="bigfield"><input placeholder="Address" name="address" type="text" /></li>
<li class="bigfield"><input placeholder="Postcode" name="postcode" type="text" /></li>
<li class="bigfield"><input placeholder="Date of birth" name="dob" type="text" /></li>
<li class="bigfield"><input placeholder="Home Phone" name="homephone" type="tel" /></li>
<li class="bigfield"><input placeholder="Mobile Phone" name="mobilephone" type="tel" /></li>
<li class="bigfield"><input placeholder="EMail" name="email" type="text" /></li>
</ul>
<span class="graytitle">Emergency Contact Details</span>
<ul class="pageitem">
<li class="bigfield"><input placeholder="Name" name="ename" type="text" /></li>
<li class="bigfield"><input placeholder="Home Phone" name="ehomephone" type="tel" /></li>
<li class="bigfield"><input placeholder="Mobile Phone" name="emobilephone" type="tel" /></li>
<li class="bigfield"><input placeholder="Work Phone" name="eworkphone" type="tel" /></li>
<li class="bigfield"><input placeholder="Relationship to you" name="erelationship" type="text" /></li>
<li class="button"><input name="name" type="submit" value="Submit input" /></li>
</form>
</div>
<div id="footer">
<!-- Support iWebKit by sending us traffic; please keep this footer on your page, consider it a thank you for my work :-) -->
<a class="noeffect" href="http://snippetspace.com">iPhone site powered by iWebKit</a></div>
</body>
</html>
The PHP file. I'm only taking the 'name' form field so far. If I can get one field working, then the rest will follow.
:
<?php
if (isset($_POST['submit'])) {
$mode = "email";
$name = $_POST['name'];
//define mail function fields
$recipient = "jillsandwich@gafgold.com";
$subject = "New Client Details";
$content = "Client Details:\n
Name: $name\n";
mail($recipient, $subject, $content, $header);
exit;
}
?>