logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 07-23-2011, 11:26 AM   #1
thecheekymonkey
 
Join Date: Jul 2011
Posts: 6
Default Sendresults.php

Hi first of all ive done a lot of searching and reading and havent found a solution to this problems, i am far from fluent in web design of php etc etc

my problem is this.

i have a template i have downloaded and edited nicely for my site.
there is a contact form on the end, so i did some googling and found this guide

http://www.dreamweaverclub.com/dreamweaver-php-form.php

i have followed it and got the contact form working, however i receive emails no problems, but they are always blank, that is to say it contains my custom heading and sends it to the right address, but in the email i get

Results from form:

but nothing else, no email address, name or message.

here is my dreamweaver form code (bear with me if its wrong lol.

Code:
<article class="col1 pad_left1">
                    <h2>Contact Form</h2>
                    <form action="http://www.xxxx.co.uk/sendresults.php" method="post" id="ContactForm">
                        <div>
                            <div class="wrapper"><input class="input" type="text" value="Name:" onBlur="if(this.value=='') this.value='Name:'" onFocus="if(this.value =='Name:' ) this.value=''" ></div>
                            <div class="wrapper"><input class="input" type="text" value="Email:" onBlur="if(this.value=='') this.value='Email:'" onFocus="if(this.value =='Email:' ) this.value=''" ></div>
                            <div class="wrapper"><input class="input" type="text" value="Tel:" onBlur="if(this.value=='') this.value='Fax:'" onFocus="if(this.value =='Fax:' ) this.value=''"></div>
                            <div class="textarea_box"><textarea cols="1" rows="1" onBlur="if(this.value=='') this.value='Message:'" onFocus="if(this.value =='Message:' ) this.value=''" >Message:</textarea></div>
                            <a href="javascript:" class="button" onClick="document.getElementById('ContactForm').reset()">clear</a>
                            <a href="javascript:" class="button" onClick="document.getElementById('ContactForm').submit()">send</a>
                        </div>
                    </form>
                </article>
and here is my sendresults.php

Code:
<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'CONTACT FORM FROM xxxx';

// Your email address. This is where the form information will be sent.
$emailadd = 'Help@xxxx.co.uk';

// Where to redirect after form is processed.
$url = 'http://www.xxxx.co.uk';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$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.'">';
?>
many thanks for the help, ive edited emails and webbys out
thecheekymonkey is offline   Reply With Quote
Old 07-24-2011, 12:29 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

give your form fields a name/id
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 07-24-2011, 09:22 AM   #3
thecheekymonkey
 
Join Date: Jul 2011
Posts: 6
Default

hi, i dont suppose you could be more detailed / example? not really my thing php / web building.

many thanks.

cheers
thecheekymonkey is offline   Reply With Quote
Old 07-25-2011, 02:05 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

<input class="input" type="text" name"fax" id="fax" value="Tel:" onBlur="if(this.value=='') this.value='Fax:'" onFocus="if(this.value =='Fax:' ) this.value=''">

then the value will be passed as $_POST['fax']
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 07-25-2011, 08:43 AM   #5
thecheekymonkey
 
Join Date: Jul 2011
Posts: 6
Default

so ive edited my dreamwever code as this and it still doesnt work.

cheers for the patience and help.

Code:
<form action="http://www.xxxx.co.uk/sendresults.php" method="post" id="ContactForm">
                        <div>
                            <div class="wrapper"><input class="input" type="text" name"Name:" id="Name:" value="Name:" onBlur="if(this.value=='') this.value='Name:'" onFocus="if(this.value =='Name:' ) this.value=''" ></div>
                            <div class="wrapper"><input class="input" type="text" name"Email:" id="Email:" value="Email:" onBlur="if(this.value=='') this.value='Email:'" onFocus="if(this.value =='Email:' ) this.value=''" ></div>
                            <div class="wrapper"><input class="input" type="text" name"Tel:" id="Tel:" value="Tel:" onBlur="if(this.value=='') this.value='Tel:'" onFocus="if(this.value =='Tel:' ) this.value=''"></div>
                            <div class="textarea_box"><textarea cols="1" rows="1" onBlur="if(this.value=='') this.value='Message:'" onFocus="if(this.value =='Message:' ) this.value=''" >Message:</textarea></div>
                            <a href="javascript:" class="button" onClick="document.getElementById('ContactForm').reset()">clear</a>
                            <a href="javascript:" class="button" onClick="document.getElementById('ContactForm').submit()">send</a>
                        </div>
                    </form>
thecheekymonkey is offline   Reply With Quote
Old 07-25-2011, 09:03 AM   #6
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

hm it should try deleting the following incase its character numbers

$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 07-25-2011, 09:36 AM   #7
thecheekymonkey
 
Join Date: Jul 2011
Posts: 6
Default

Sorry still didnt work, have edited code now to this

Code:
<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'CONTACT FORM FROM XXXX';

// Your email address. This is where the form information will be sent.
$emailadd = 'Help@XXXX.co.uk';

// Where to redirect after form is processed.
$url = 'http://www.XXXX.co.uk';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
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.'">';
?>

and still no message....cheers for the help
thecheekymonkey is offline   Reply With Quote
Old 07-25-2011, 10:01 AM   #8
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

wait i just read this properly
Quote:
Results from form:

but nothing else, no email address, name or message.Results from form:

but nothing else, no email address, name or message.
what message you still havent named the textfield and what email do you meanif you get form fields?
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 09-23-2011, 08:05 PM   #9
estebandraws
 
Join Date: Sep 2011
Posts: 1
Default

I was having the same problem. No results in the email that was generated.

When I changed the encoding type to multipart/form-data it sent the form fields in the email.
estebandraws is offline   Reply With Quote
Old 09-24-2011, 03:11 AM   #10
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

that would change anything in this case
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:45 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com