PDA

View Full Version : Custom Form Email + Submit to db


kremo5le
01-11-2009, 04:39 PM
Hello guys,

I have found posts on how to email a form and how to process it to include the fields within the database. However, I need both done, and so far I don't know what to do to how to email it (together with submitting it into the database). My form is a "registration.php" file and all the different connections to the database are done successfully.

What am I missing?

Here's the code:

<div class="lighttext" style="margin:20px">
<h2>New Dealer Registration Form</h2>
<form action="<?php echo $editFormAction; ?>" method="POST" name="registrationform" id="registrationform">
<table width="560" border="0" cellspacing="5">
<tr>
<td width="253" class="lighttext"><div align="right">
<label><span class="lighttext">Business Name</span></label>
</div></td>
<td width="288"><div align="left">
<input name="businessname" type="text" id="businessname" size="25" maxlength="50">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label class="lighttext">Contact Name</label>
</div></td>
<td><div align="left">
<input name="username" type="text" id="username" size="25" maxlength="50">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label class="lighttext">E-mail Address</label>
</div></td>
<td><div align="left">
<input name="emailaddress" type="text" id="emailaddress" size="25" maxlength="50">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right"><label>Create Password</label></div> </td>
<td><div align="left">
<input name="password" type="password" id="password" size="25" maxlength="12">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>Re-Enter Password</label>
</div></td>
<td><div align="left">
<input name="password2" type="password" id="password2" size="25" maxlength="12">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>Website Address</label>
</div></td>
<td><div align="left">
<input name="website" type="text" id="website" size="25" maxlength="50">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>Phone Number</label>
</div></td>
<td><div align="left">
<input name="phonenumber" type="text" id="phonenumber" size="25" maxlength="12">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>Fax Number</label>
</div></td>
<td><div align="left">
<input name="faxnumber" type="text" id="faxnumber" size="25" maxlength="12">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>Address</label>
</div></td>
<td><div align="left">
<input name="address" type="text" id="address" size="25" maxlength="50">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>City, State, Zip</label>
</div></td>
<td><div align="left">
<input name="citystatezip" type="text" id="citystatezip" size="25" maxlength="50">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>Description of your business</label>
</div></td>
<td><div align="left">
<textarea name="description" cols="45" rows="10" id="description"></textarea>
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>How did you hear about Nutreve?</label>
</div></td>
<td><div align="left">
<textarea name="howhear" id="howhear" cols="45" rows="10"></textarea>
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>California Reseller Permit # (if applicable)</label>
</div></td>
<td><div align="left">
<input name="crp" type="text" id="crp" size="25" maxlength="10">
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right">
<label>
<input type="reset" name="reset" id="reset" value="Reset Form">
</label>
</div></td>
<td><div align="left">
<label>
<input type="submit" name="submit" id="submit" value="Open Account">
</label>
</div></td>
</tr>
<tr>
<td class="lighttext"><div align="right"></div></td>
<td><div align="left"></div></td>
</tr>
</table>
<p>
<input type="hidden" name="MM_insert" value="registrationform">
</p>
</form>
</div>

edbr
01-12-2009, 12:10 AM
you show the action as
<?php echo $editFormAction; ?>
what ever that is of coursee I dont know, but the page that the action is pointed to must contain a mail handling script and an insert selection , it will one processed one after another. so the code for that might be better

kremo5le
01-12-2009, 03:13 PM
you show the action as
<?php echo $editFormAction; ?>
what ever that is of coursee I dont know, but the page that the action is pointed to must contain a mail handling script and an insert selection , it will one processed one after another. so the code for that might be better

Hello there,

I'm using the database behaviors for this to work. I created the form and then I used this toll I'm mentioning. I don't think I need to create 2 files if one is doing the whole thing. Does that make sense? :mrgreen:

What's the best way to add that piece of code my friend? :(

Thank you for your time!

kRem

edbr
01-12-2009, 11:28 PM
no 1 form wold do it. it will be processed from top to bottom. so if the action page should have your mail handling script which should 1st validate ,then have a mail() section for example to send the mail then collect the post vars, and use an insert statement and this will add the details you select to your database

kremo5le
01-14-2009, 01:56 AM
no 1 form wold do it. it will be processed from top to bottom. so if the action page should have your mail handling script which should 1st validate ,then have a mail() section for example to send the mail then collect the post vars, and use an insert statement and this will add the details you select to your database

Hello there,

I actually had my PHP friend solve it for me. It wasn't as easy as I thought!

Moreover, I need to create a simple form in which the person using it can select product quantities from a drop down list (per product). The way it will work is having 13 areas, one for each product, where the customer will select a quantity and it will automatically start adding that to a total at the bottom to then be submitted via email.

What's be the best way to approach this new form? :mrgreen:

kRem