Page 1 of 1

Simple contact form PHP script

Posted: Tue Apr 06, 2010 5:58 pm
by psionw35
I am very new to website design and have managed to get my head around most things in dreamweaver but am now struggling to write a working PHP script for the following contact page: -

<form id="Contact Form" name="Contact Form" method="post" action="process-form.php">
<table width="709" border="0">
<tr>
<td width="346"><span id="sprytextfield1">
<label> name:*<br />
<input type="text" name="name" id="name" />
</label>
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
<td width="353"><span id="sprytextfield2">
<label>address:*<br />
<input type="text" name="address" id="address" />
</label>
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td><span id="sprytextfield4">
<label>tel:*<br />
<input type="text" name="tel" id="tel" />
</label>
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
<td><span id="sprytextfield3">
<label>town:*<br />
<input type="text" name="town" id="town" />
</label>
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td><span id="sprytextfield5">
<label>email:*<br />
<input type="text" name="email" id="email" />
</label>
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
<td><span id="sprytextfield6">
<label>postcode:*<br />
<input type="text" name="postcode" id="postcode" />
</label>
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td valign="top"><span id="spryselect1">
<label>please contact me about:*<br />
<select class="textareaMinCharsState">
<option>selling my property</option>
<option>letting my property</option>
<option>ordering a HIP</option>
<option>ordering an EPC</option>
<option>mortgages</option>
</select>
</label>
<span class="selectInvalidMsg">Please select a valid item.</span></span>
<p>
<label>
<input type="submit" name="submit" id="submit" value="submit" />
</label>
</p></td>
<td><span id="sprytextarea1">
<label>description:*
<br />
<textarea name="description2" id="description" cols="45" rows="5"></textarea>
</label>
<span class="textareaRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>

Could somebody please help with what should be a very simple task but as yet too complex for my limited experience?

Many thanks

Psionw35

Re: Simple contact form PHP script

Posted: Tue Apr 06, 2010 7:12 pm
by shenjeff
This is the HTML you would use to get the replies from the person. You will then need process-form.php to catch the variables using $_POST['name'] etc. using that process-form.php then you can do whatever you want with the variables