PDA

View Full Version : head is breaking over sending emailform in Dreamweaver to my email


Heyokahaha
01-20-2012, 03:54 PM
Hello,

I am doing my websites with dreamweaver for a while and now because of working with a template I couldn't get my email buttons right, so I decided to build a contact form, this was very easy to do.
But then, and this is what I missed in the first googling I did, I wanted to SEND it to my email.

I tried googling, but really... my head is breaking over php.
In this moment I created a php file in my root folder. I adapted the properties of the form, renamed the action to the php file, and then... nothing happens AT ALL when I click the button. Where did I go wrong?

The contact form is here ;
http://www.companyenergetics.be/Contact.html

<td width="100%" height="416"><form action="FormtoEmail.php" method="post" enctype="application/x-www-form-urlencoded" name="ContactForm" id="ContactForm">
<p class="style33">Uw gegevens : </p>
<table width="98%" border="0" cellspacing="5">
<tr>
<td height="34"><span class="style29">
<label>Naam :
<input type="text" name="textfield" />
</label>
</span></td>
<td><span class="style29">
<label>Email :
<input type="text" name="textfield3" />
</label>
</span></td>
</tr>
<tr>
<td height="44"><span class="style29">
<label>Firma :
<input type="text" name="textfield2" />
</label>
</span></td>
<td><span class="style29">
<label>Telefoon :
<input type="text" name="textfield4" />
</label>
</span></td>
</tr>
</table>
<p class="style31">
<label></label>
<span class="style34">.</span></p>
<p class="style31"><span class="style33">U wenst :</span>
<label>
<br />
<input type="checkbox" name="checkbox" value="checkbox" />
<span class="style29"> een offerte</span></label>
<span class="style29">
<label>
<input type="checkbox" name="checkbox2" value="checkbox" />
een inschrijving</label>
<label>
<input type="checkbox" name="checkbox3" value="checkbox" />
meer informatie</label>
</span></p>
<p class="style29">Voor de cursus :
<label>
<input type="checkbox" name="checkbox4" value="checkbox" />
Company Energetics</label>
<label>
<input type="checkbox" name="checkbox5" value="checkbox" />
Body Energetics</label>
</p>
<p class="style29">Gegeven als:
<label>
<input type="checkbox" name="checkbox6" value="checkbox" />
In Company Training </label>
<label>
<input type="checkbox" name="checkbox7" value="checkbox" />
Open Training </label>
</p>
<p class="style29">Datum :
<input type="text" name="textfield5" />
</p>
<p class="style29">. </p>
<p class="style31">
<label><span class="style33">Vragen of opmerkingen : </span></label>
</p>
<p class="style31">
<textarea name="textarea" cols="70" rows="5" class="style31"></textarea>
</p>
</form>



and here is the php i was trying to adapt but now I am really having a headache and i am ready to throw my computer out of the window:-) Please help...?

<?php
$my_email = "hilde.goris@heyokateljee.be";
$subject = 'Results from Contact form Energetics';
$emailadd = 'hilde.goris@heyokateljee.be';
$url = 'http://www.companyenergetics.be';

<?php
$text = "Results from form:ContactForm";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

Thank you SO much in advance...

Hilde

Corrosive
01-20-2012, 04:13 PM
Have you checked the easy stuff like you have php on your server and your hosts allow the mail() function to be used? Some hosts disable mail() for security so you have to use SMTP.

edbr
01-21-2012, 01:33 AM
Put your submit button inside the form and it will work or it wont do anything

Heyokahaha
01-21-2012, 10:02 AM
Tnx so much at least it is sent now....!!! I was looking over this one after all these hours doing very difficult stuff for me designer nitwit! It is working now and now I have to try to get the checkboxes renamed, so I can see what was indicated by the sender. The mail is saying now : checkbox4, 7... I know it is a bit lazy... but anyone willing to explain where I do this or where I find some clear instructions to rename the checkboxes in the php or html? I labeled them but the labeled name is not getting out...

I am SO happy already with this result!

Sun on your path, wind in the ailes,

Hilde:-D

edbr
01-24-2012, 02:02 AM
in your form, if you give the checkboxes value a positive
ie
<input type="checkbox" name="offerte" value="ya!" />
if selected it will show
offerte: ya!

Heyokahaha
01-24-2012, 08:34 PM
:grin: Hello :grin:
I was trying a little and I noticed that like this, the mail is indicating already the checked boxes, so I just renamed them... Tnx alot for your help, you made my day on friday!

Greetz,

Hilde

edbr
01-25-2012, 01:15 AM
welcome or welkom perhaps

Heyokahaha
01-25-2012, 08:15 AM
Haha, you speak dutch:-) We say 'graag gedaan' for this one:-)

edbr
01-25-2012, 09:05 AM
i know my wife used to say that to me a long time ago now its kop dicht!

Heyokahaha
01-25-2012, 09:14 AM
Hahahaha, kop dicht! You talk alot then:-) If I would say this to my husband, the effect would be the other way around... he would get very mad:-)