PDA

View Full Version : form just won't work - please help!


JBD
07-31-2007, 08:30 PM
Hi, I've almost finished a clients website (the first I've ever attempted) and now I'm trying to add a customer survey form which I have created but am having trouble making the 'send to email' part work.

http://jonballdesign.co.uk/Client%20Work/Cannon/CannonsecurityCustomerserviceform.html

The form shows up on my server but when I upload to my clients server I get the following message saying not found:

http://www.cannonsecurity.co.uk/public_html/CannonsecurityCustomerserviceform.html

As you can see I am using a script from:

http://www.gifford.co.uk/form-mailer.html

which I believe I have followed their instructions. But when I click submit it still shows up with the Clifford home page and I get no email with results.

So anyway, has anyone got any ideas on these issues as I can't handle many more sleepless nights.

Kind Regards

JBD

Mark_W
07-31-2007, 10:47 PM
The form shows up on my server but when I upload to my clients server I get the following message saying not found:

http://www.cannonsecurity.co.uk/public_html/CannonsecurityCustomerserviceform.html



Because its here, http://www.cannonsecurity.co.uk/CannonsecurityCustomerserviceform.html

Even though you uploaded the files into a folder called public_html you dont need to put public_html into the address bar. In effect you could say http:// is the public_html folder.

Mark_W
07-31-2007, 10:55 PM
The reason why the form isn't being sent to your email is because you haven't changed the form to be what you want it to be, you have simply copied the link from the gifford website and inserted it onto yours. And that wont work.

I would never suggest creating a form and using script which has come from the same direction you have taken it from.

I would suggest, if your host allows you to use PHP, to create a php form, which will take about 10 minutes to do. And it is easier to understand. (for me anyway)

Jittor
08-01-2007, 03:39 PM
JBD do you know if your host supports PHP? Mark is right, it is far easier to use PHP.

And it is easier to understand. (for me anyway)

That goes for me as well.

JBD
08-01-2007, 07:52 PM
Hey thanks for the help so far!

I use 1and1 which I'm assuming support PHP though my client use Gifford and I've had a quick look at their site but there's no mention of PHP. I'm probably gonna have to contact them to make sure first.

So can I apply PHP to the form I've already designed or do I need to start over. Sorry I'm pretty new to web design and Dreamweaver...

Thanks again!

kate
08-01-2007, 08:04 PM
Hello JBD,

You may find that in your welcome mail when you signed up. Yes they support PHP but not for the 1&1 'beginner' hosting. Although its not too expensive its a big jump from 1.99 to a fiver.

Still cheaper than mine which is 7.00 but its the business package.

:(

JBD
08-01-2007, 09:00 PM
Hi Kate thanks for that

Just a quick question seeing as you are a 1and1 Business package user - I've recently done an ebay shop for my mum

http://stores.ebay.co.uk/Peruvianbabe_W0QQsspagenameZMEQ3aFQ3aSTQQtZkm

and she wants something similar to this as her home page for her website. Now she also has the business package and I can't seem to find a suitable page (within the package) to use as a home page other than the 'about us' page that they provide. When I paste the html into this it shows up fine but I'm finding it hard to make the links to the categories work. The problem I get is when you click on a category all it does is duplicate the left side menu:

https://sslrelay.com/www.peruvianbabe.com/sess/utn;jsessionid=1546b0eff9d27c9/shopdata/index.shopscript

Do you (or anyone else reading this) know how I can link to the categories?

Any advice would be greatly appreciated

JBD

JBD
08-01-2007, 09:08 PM
Sorry my mistake - just realised she actually has the Pro eshop package and not the business one as you mentioned. Well anyway, perhaps you or someone can still help?

Thanks!

Mark_W
08-01-2007, 09:10 PM
OK, sorry I'm getting a bit lost in this thread now. Are you wanting to now create the form you originally posted in PHP?

If so then I can help you.

JBD
08-01-2007, 09:17 PM
Yeah sorry I went off the original subject a little on another problem I'm having but yes if you can help with the form then that would be great! Having said this I'm still unsure, until I contact Gifford tomorrow (my clients ISP), if they support PHP.

davidj
08-01-2007, 09:25 PM
do you have access to the host space

JBD
08-01-2007, 09:27 PM
Yes - they seem to trust me :)

davidj
08-01-2007, 09:32 PM
ok

create a file (blank)

name it phpinfo.php

add the following code and save it


<?php

phpinfo();

?>


FTP that file to your host space then browse for it......

example..
http://www.domain.com/phpinfo.php

if you get some information in purple and white its a thumbs up
if you get a download prompt then you dont have php on your space

JBD
08-01-2007, 09:40 PM
Ok, I managed that I think

http://www.cannonsecurity.co.uk//phpinfo.php

davidj
08-01-2007, 09:55 PM
yes you have PHP

weh hey....

now regarding the other guys

i dont want to steal their thunder so will bow out and let you seek enlightenment from the guys

ok guys its all yours

JBD
08-01-2007, 09:59 PM
Cheers David, well at least that will save me a phone call tomorrow. Lets just hope someone else can 'enlighten' me...

davidj
08-01-2007, 10:00 PM
would you like to learn how to program in PHP

davidj
08-01-2007, 10:01 PM
http://www.dreamweaverclub.com/vtm/php-mysql-apache.php

JBD
08-01-2007, 10:34 PM
Ok, I've listened to the first two tutorials - I noticed you use PC and I'm just wondering if these apps you mention work fine on mac as well? Plus, forgive me for sounding lazy, but is it necessary to listen to 2hrs of tutorials and use the mentioned software just to make my form work?

I've only experience with designing from a visual perspective and am only just grasping the basics of html - perhaps I was naive in thinking adding a little PHP to make my form work would be a ten minute job. Sorry for going on only I'm now thinking it would be best to advice my client to get someone else to make the form work.

davidj
08-01-2007, 10:51 PM
the form is simple so dont worry

if your only wanting to develop static web sites then you dont need to know PHP but if your starting a web dev business then your missing out on allot.

You cant really approach your client and leave the stuff you cant do at his feet. You learn how to do the stuff you cant do. This is what the web is about and what web development is about. You push your knowledge further and further constantly.

Mark_W
08-01-2007, 10:59 PM
If you want to learn PHP then I would suggest watching David's video tutorials, as they have helped me a lot over the past few months, and I can honestly say that if it wasn't for the help I have received from the video tutorials and from David himself then I wouldn't feel as comfortable as I do now with PHP.

Don't advise your client to get someone else to do the form, its east business doing a PHP form.

Right, ill start explaining what you need to do.

JBD
08-01-2007, 11:03 PM
Don't get me wrong I am keen to learn as much as possible, including PHP, only I was hoping it would be no more than an evenings work to finish the form as the client (as they always do) want it done asap. If it can be possible to learn just enough PHP to get the form complete in the short term then learn more as I go along then great. Realistically for a complete beginner how long should it take? Sorry again for sounding impatient, your advice is much appreciated :)

davidj
08-01-2007, 11:08 PM
PHP is constantly changing so that means we are all constantly learning

the vids will give you a grounding. Building blocks of php

once you understand them you can do anything you like

like....

Doh - Ray - Me - Fa - Soh - Lah - Te - Doh

but without Julie Andrews

Mark_W
08-01-2007, 11:23 PM
First of all you need to do a couple of minor things to your form.

Ensure that each of the fields on your form has a 'name'

Next create a new php page and save this as sendform.php

Go into code view and delete all the code from the page.

Next insert the following line of code:

<?phpThis starts the php coding.

Next you need to create some variables which will store the information from the fields so they can be used elsewhere in the form processor.

So, add a couple of spaces below the <?php tag and insert the following code:


$name = $_POST['Name'];
$ref = $_POST['Ref Number'];
$qone = $_POST['_questone'];The $name, $ref, $qone are all variables and can be named whatever you want.

$_POST['Name']; is telling the page to post whatever data is in the field with the name 'Name'

Repeat the coding above but with the other form names.

Once you have done that, create two more spaces below the variables and insert the following code:


$recipient = "Email@email.com"; //Self explanatory, put the email address here you want the email to be sent to.
$subject = 'Subject of the email'; //Again self explanatory, this is the subject which will appear on the email

Next create another couple of lines below and insert the following code:


$message = "Name: $name \n"; //this is the first line of the message, note here that the variable from the top of the page is also here.
$message .= "Reference Number: $ref \n"; //same as above, but this line will be displayed below the above.
$message .= "Engineers Punctuality: $qone \n"; //same as above


Again, create another couple of lines below and insert the following code:


$headers = "From: $name"; //this line of code will display who has sent the form (maybe want to consider allowing the user to put their email address, so that the owner of the site can reply to any customer complaints?

next we get onto an important part of the form:


mail($recipient,$subject,$message,$headers); //This takes all the information stored in the relevant variables and sends it to the email
header ("Location: index.html"); //This will be the location you want the page to go to once the form has been submitted

Next end the coding with this:

?> //This finishes the PHP page

That is a very very basic php form, sorry for the rushness of this, There are a couple of things I want to suggest, but I need the toilet, so go through this reply and post if there are any problems.

Mark

Mark_W
08-01-2007, 11:39 PM
Oh, for the following:

$message = "Name: $name \n"; //this is the first line of the message, note here that the variable from the top of the page is also here.
$message .= "Reference Number: $ref \n"; //same as above, but this line will be displayed below the above.
$message .= "Engineers Punctuality: $qone \n"; //same as above

You want to do that for all of the form options

Mark_W
08-02-2007, 12:00 AM
Oh sorry just realised I havent told you how to link the form to the php page.

Change this:
ACTION="http://www.gifford.co.uk/cgi-bin/utils/form_mail.pl"

To this:
ACTION="sendform.php"

Mark_W
08-02-2007, 12:18 AM
Your reference number wont display either as you have a gap between your form name, remove the gap:

'Ref Number' > 'RefNumber'

JBD
08-02-2007, 06:57 AM
This is great Mark thanks! - Had to get some sleep last night but will continue with your instructions, when I get home from my day job, this evening. Just quickly reading through before leaving to work but is this all the instructions or do you plan to add more? ?Anyway, I'll carry on with this and post again later...

Many thanks!

kate
08-02-2007, 07:35 AM
It would seem over night (I don't surf much after 9pm) there has been a misunderstanding.

JBD hi, I am not hosted with 1&1 I am with two others. http://www.ukhost4u.com/

Been with the above since 1998 or so. The business package gives me everything I could ever want for web design but I don't really use it like that as I have no site as yet. I get 1000 mb of space, unlimted bandwidth and a free domain. You can get cheaper from them but I want the lot..haahahah
http://www.charlottezweb.com/autopilot/step_one.php
Jason: I just joined him but don't really use that either but at $5 I won't be complaning. I also have a site (not using) at IPB you can just host the forum if you like. Maybe I will do plants and flowers sometime.

Nice to see you got sorted out with the guys on the form.

Now:

This Ebay: Well you do know its been done professionally of course and I have taken a look this morning. Its got a background image, you could have the nice images you want as links in a table or done by CSS and linked. You could do the whole thing in Dreamweaver.

If you look at that e-bay page in IE you can't do a 'view source' to see how its done so if you have ff then you can, you can also look at the CSS in ff too at the same time. Just another way of learning how pages are built.

HTH.

:mrgreen:

JBD
08-02-2007, 01:39 PM
Hi Kate, my misunderstanding with the whole ISP thing

Regarding the ebay shop - sorry but are you implying that the Peruvianbabe ebay shop was done 'professionally'? If so then thanks as this is actually my first attempt. The problem is, actually trying to use this same design/code as a homepage for her website.

https://sslrelay.com/www.peruvianbabe.com/sess/utn1546b0ef41786df/shopdata/index.shopscript

I've noticed the 'sslrelay' part of the link, which I am not familiar with, and I'm wondering if this is perhaps part of the problem???

kate
08-02-2007, 04:03 PM
Regarding the ebay shop - sorry but are you implying that the Peruvianbabe ebay shop was done professionally?


You mean you did that design...whooooo if thats so ..boy do I need to hire you in the future.

I am impreassed so whats up then?


The problem is, actually trying to use this same design/code as a homepage for her website.



If you want the same then it will be in the view source (only FF) unless there is any Flash. There is some kind of animation going on so maybe Flash or Swish software I think.

Did you not make a master template in Dreamweaver when you created the site.
:mrgreen:

JBD
08-02-2007, 08:20 PM
Ok Mark I think I have done everything you said but still a few problems.

When I click submit I get this message

http://www.cannonsecurity.co.uk/sendform.php

then I receive an email which contains the correct title but the main body only says "other comments" and nothing else???

I'm guessing I've done something slightly wrong with the coding

<title>send form</title><?php

$name = $_POST['Name'];
$ref = $_POST['RefNumber'];
$question1 = $_POST['_questone'];
$punctuality = $_POST['punctuality'];
$question2 = $_POST['_questtwo'];
$attitude = $_POST['attitude'];
$question3 = $_POST['_questthree'];
$engineers_response = $_POST['engineers_response'];
$question4 = $_POST['_questfour'];
$cleanliness = $_POST['cleanliness'];
$question5 = $_POST['_questfive'];
$office_response = $_POST['office_response'];
$question6 = $_POST['_questsix'];
$office_manner = $_POST['office_manner'];
$question7 = $_POST['_questseven'];
$office_queries = $_POST['office_queries'];
$question8 = $_POST['_questeight'];
$office_complaints = $_POST['office_complaints'];
$other_comments = $_POST['other_comments'];

$recipient = "jonballdesign@hotmail.com";
$subject = 'Website Customer Survey Form';

$message = "Name: $name \n";
$message = "Reference Number: $RefNumber \n";
$message = "Engineers Punctuality: $_questone \n";
$message = "Comments on engineers punctuality: $punctuality \n";
$message = "Engineers attitude: $_questtwo \n";
$message = "Comments of engineers attitude: $attitude \n";
$message = "Engineers response: $_questthree \n";
$message = "Comments on engineers response: $engineers_response \n";
$message = "Cleanliness: $_questfour \n";
$message = "Comments on engineers cleanliness: $cleanliness \n";
$message = "Office Response: $_questfive \n";
$message = "Comments on office staff telephone response: $office_response \n";
$message = "Office Manner: $_questsix \n";
$message = "Comments on office staff telephone manner: $office_manner \n";
$message = "Office Queries: $_questseven \n";
$message = "Comments on office staff's respone to queries: $office_queries \n";
$message = "Office Complaints: $_questeight \n";
$message = "Comments on office staff response to complaints: $office_complaints \n";
$message = "Other Comments: $other_comments \n";

$headers = "From: $name";

mail($recipient,$subject,$message,$headers);
header ("Location: http://jonballdesign.co.uk/");

?> //

Please help...

Mark_W
08-02-2007, 08:27 PM
First of all you dont need the <title></title> tags on at the top, so remove that part.

As for line 49, which is the header line, put the url into a var, so

header ("Location: $url");Then add the $url var below the $other_comments var, so:


$other_comments = $_POST['other_comments'];
$url = "http://jonballdesign.co.uk/";

That should sort it out, then try the form again and see if all the contents are sent.

JBD
08-02-2007, 08:28 PM
Thanks I'm glad you like the design - it was tricky designing something girly but my mums very happy...

The animations are simply animated gifs using Adobe ImageReady

I've managed to get the code into her eshop package

https://sslrelay.com/www.peruvianbabe.com/sess/utn1546b0ef41786df/shopdata/index.shopscript

but even though I have changed the links to match the links within her eshop they still do not work properly - when you click on one it just duplicates the left hand side menu.

Mark_W
08-02-2007, 08:34 PM
Sorry! I forgot to say last night to put dots before the = signs like below. That will should sort your problem out. And should also remind me not to give php help when im half asleep.



$message = "Name: $name \n";
$message .= "Reference Number: $RefNumber \n";
$message .= "Engineers Punctuality: $_questone \n";
$message .= "Comments on engineers punctuality: $punctuality \n";
$message .= "Engineers attitude: $_questtwo \n";
$message .= "Comments of engineers attitude: $attitude \n";
$message .= "Engineers response: $_questthree \n";
$message .= "Comments on engineers response: $engineers_response \n";
$message .= "Cleanliness: $_questfour \n";
$message .= "Comments on engineers cleanliness: $cleanliness \n";
$message .= "Office Response: $_questfive \n";
$message .= "Comments on office staff telephone response: $office_response \n";
$message .= "Office Manner: $_questsix \n";
$message .= "Comments on office staff telephone manner: $office_manner \n";
$message .= "Office Queries: $_questseven \n";
$message .= "Comments on office staff's respone to queries: $office_queries \n";
$message .= "Office Complaints: $_questeight \n";
$message .= "Comments on office staff response to complaints: $office_complaints \n";
$message .= "Other Comments: $other_comments \n";

$headers = "From: $name";

kate
08-02-2007, 08:36 PM
Well if its any help,

I clicked on postage and packing' and ended up at ebay which is this link but now I must go:

http://stores.ebay.co.uk/Peruvianbabe/Information.html

:mrgreen:

Mark_W
08-02-2007, 08:38 PM
Sorry! I forgot to say last night to put dots before the = signs like below. That will should sort your problem out. And should also remind me not to give php help when im half asleep.



Hang on a minute why am I blaming myself! I did say to put the dots in. :lol:

JBD
08-02-2007, 08:45 PM
Yes Mark you did mention the dots and right until the end I did have them but wondered why you did not put one on the "Name" and thought it may have been a typo error... My mistake!

Well anyway it seems to work fine now (minus a few tweaks here and there with the design of the form)

Many thanks for your help, you are a life saver - I will def be learning more PHP in the future!

JBD

Mark_W
08-02-2007, 08:48 PM
Thats ok, no problem glad I could help.

davidj
08-02-2007, 09:13 PM
nice one mark

JBD
08-05-2007, 02:56 PM
Ok, need a bit more help on this form please guys. I just can't get some of the fields to show up in the email response
http://i31.photobucket.com/albums/c394/jonballdesign/emailresponse.jpg
Here is my code for the form:

FORM NAME="guns"
METHOD="POST"
ACTION="sendform.php"
onSubmit="return validate();">

<INPUT NAME="---subject" VALUE="Customer Survey Form" TYPE=hidden>

<INPUT NAME="---url" VALUE="http://www.cannonsecurity.co.uk/" TYPE=hidden>

<INPUT NAME="---mailer" VALUE="/usr/sbin/sendmail" TYPE=hidden>

<INPUT NAME="---address" VALUE="jonballdesign@hotmail.com" TYPE=hidden>

<p class="style38 style39"><u>Your details (optional)</u></p>
<p class="style38">Name
<input name="Name" type="text" class="style31" id="Name" size="20" maxlength="40">
Reference No.
<input name="RefNumber" type="text" class="style31" id="RefNumber" size="10" maxlength="20">
</p>
<p class="style40"><u>Please comment on the following and also rate fom 1 - 5</u></p>
<p class="style38">(1)<span class="style40">Unacceptable</span> (2)<span class="style40">Poor</span> (3)<span class="style40">OK</span> (4)<span class="style40">Good</span> (5)<span class="style40">Excellant</span></p>
<p class="style38">&bull;The Engineers punctuality: </p>
<p class="style38">1
<input name="_questone" type="radio" class="style31" value="one">
2
<input name="_questone" type="radio" class="style31" value="two">
3
<input name="_questone" type="radio" class="style31" value="three">
4
<input name="_questone" type="radio" class="style31" value="four">
5
<input name="_questone" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="punctuality" type="text" class="style31" id="punctuality" size="75" maxlength="200">
</p>
<p class="style38">&bull;The Engineers attitude:</p>
<p class="style38">1
<input name="_questtwo" type="radio" class="style31" value="one">
2
<input name="_questtwo" type="radio" class="style31" value="two">
3
<input name="_questtwo" type="radio" class="style31" value="three">
4
<input name="_questtwo" type="radio" class="style31" value="four">
5
<input name="_questtwo" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="attitude" type="text" class="style31" id="attitude" size="75" maxlength="200">
</p>
<p class="style38">&bull;The Engineers response to any queries or complaints: </p>
<p class="style38">1
<input name="_questthree" type="radio" class="style31" value="one">
2
<input name="_questthree" type="radio" class="style31" value="two">
3
<input name="_questthree" type="radio" class="style31" value="three">
4
<input name="_questthree" type="radio" class="style31" value="four">
5
<input name="_questthree" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="engineersresponse" type="text" class="style31" id="engineersresponse" size="75" maxlength="200">
</p>
<p class="style38">&bull;The Engineers cleanliness:</p>
<p class="style38">1
<input name="_questfour" type="radio" class="style31" value="one">
2
<input name="_questfour" type="radio" class="style31" value="two">
3
<input name="_questfour" type="radio" class="style31" value="three">
4
<input name="_questfour" type="radio" class="style31" value="four">
5
<input name="_questfour" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="cleanliness" type="text" class="style31" id="cleanliness" size="75" maxlength="200">
</p>
<p class="style38">&bull;The Office staffs telephone response:</p>
<p class="style38">1
<input name="_questfive" type="radio" class="style31" value="one">
2
<input name="_questfive" type="radio" class="style31" value="two">
3
<input name="_questfive" type="radio" class="style31" value="three">
4
<input name="_questfive" type="radio" class="style31" value="four">
5
<input name="_questfive" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="officeresponse" type="text" class="style31" id="officeresponse" size="75" maxlength="200">
</p>
<p class="style38">&bull;The Office staffs telephone manner:</p>
<p class="style38">1
<input name="_questsix" type="radio" class="style31" value="one">
2
<input name="_questsix" type="radio" class="style31" value="two">
3
<input name="_questsix" type="radio" class="style31" value="three">
4
<input name="_questsix" type="radio" class="style31" value="four">
5
<input name="_questsix" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="officemanner" type="text" class="style31" id="officemanner" size="75" maxlength="200">
</p>
<p class="style38">&bull;The Office staffs response to queries:</p>
<p class="style38">1
<input name="_questseven" type="radio" class="style31" value="one">
2
<input name="_questseven" type="radio" class="style31" value="two">
3
<input name="_questseven" type="radio" class="style31" value="three">
4
<input name="_questseven" type="radio" class="style31" value="four">
5
<input name="_questseven" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="officequeries" type="text" class="style31" id="officequeries" size="75" maxlength="200">
</p>
<p class="style38">&bull;The Office staffs response to complaints:</p>
<p class="style38">1
<input name="_questeight" type="radio" class="style31" value="one">
2
<input name="_questeight" type="radio" class="style31" value="two">
3
<input name="_questeight" type="radio" class="style31" value="three">
4
<input name="_questeight" type="radio" class="style31" value="four">
5
<input name="_questeight" type="radio" class="style31" value="five">
</p>
<p class="style38">
<input name="officecomplaints" type="text" class="style31" id="officecomplaints" size="75" maxlength="200">
</p>
<p class="style38">&bull;Do you have any further thoughts on how we might improve on customer service?</p>
<p class="style38">
<textarea name="othercomments" cols="75" rows="8" class="style31" id="othercomments"></textarea>
</p>
<p class="style38">
<input name="Reset" type="reset" class="style31" id="Reset" value=" Reset Form ">
<input name="Submit" type="submit" class="style31" value=" Submit Details ">

</p>

JBD
08-05-2007, 02:58 PM
...and here is the PHP

<?php

$name = $_POST['Name'];
$ref = $_POST['RefNumber'];
$question1 = $_POST['_questone'];
$punctuality = $_POST['punctuality'];
$question2 = $_POST['_questtwo'];
$attitude = $_POST['attitude'];
$question3 = $_POST['_questthree'];
$engineersresponse = $_POST['engineersresponse'];
$question4 = $_POST['_questfour'];
$cleanliness = $_POST['cleanliness'];
$question5 = $_POST['_questfive'];
$officeresponse = $_POST['officeresponse'];
$question6 = $_POST['_questsix'];
$officemanner = $_POST['officemanner'];
$question7 = $_POST['_questseven'];
$officequeries = $_POST['officequeries'];
$question8 = $_POST['_questeight'];
$officecomplaints = $_POST['officecomplaints'];
$othercomments = $_POST['othercomments'];
$url = "http://www.cannonsecurity.co.uk/Cannonsecuritysurveycomplete.htm#http://www.cannonsecurity.co.uk/Cannonsecurityhome.htm";

$recipient = "jonballdesign@hotmail.com";
$subject = 'Website Customer Survey Form';

$message = "Name: $name \n";
$message .= "Reference Number: $RefNumber \n";
$message .= "Engineers Punctuality: $_questone \n";
$message .= "Comments on engineers punctuality: $punctuality \n";
$message .= "Engineers attitude: $_questtwo \n";
$message .= "Comments of engineers attitude: $attitude \n";
$message .= "Engineers response: $_questthree \n";
$message .= "Comments on engineers response: $engineersresponse \n";
$message .= "Cleanliness: $_questfour \n";
$message .= "Comments on engineers cleanliness: $cleanliness \n";
$message .= "Office Response: $_questfive \n";
$message .= "Comments on office staff telephone response: $officeresponse \n";
$message .= "Office Manner: $_questsix \n";
$message .= "Comments on office staff telephone manner: $officemanner \n";
$message .= "Office Queries: $_questseven \n";
$message .= "Comments on office staff's respone to queries: $officequeries \n";
$message .= "Office Complaints: $_questeight \n";
$message .= "Comments on office staff response to complaints: $officecomplaints \n";
$message .= "Other Comments: $othercomments \n";

$headers = "From: $name";

mail($recipient,$subject,$message,$headers);
header ("Location: $url");

?> //

I'm sure it's a stupid mistake somewhere but I've been looking for hours now and I just can't see the fault.

Please help

Thanks!
JBD

Mark_W
08-06-2007, 11:35 AM
<?php

$name = $_POST['Name'];
$ref = $_POST['RefNumber'];
$question1 = $_POST['_questone'];
$punctuality = $_POST['punctuality'];
$question2 = $_POST['_questtwo'];
$attitude = $_POST['attitude'];
$question3 = $_POST['_questthree'];
$engineersresponse = $_POST['engineersresponse'];
$question4 = $_POST['_questfour'];
$cleanliness = $_POST['cleanliness'];
$question5 = $_POST['_questfive'];
$officeresponse = $_POST['officeresponse'];
$question6 = $_POST['_questsix'];
$officemanner = $_POST['officemanner'];
$question7 = $_POST['_questseven'];
$officequeries = $_POST['officequeries'];
$question8 = $_POST['_questeight'];
$officecomplaints = $_POST['officecomplaints'];
$othercomments = $_POST['othercomments'];
$url = "http://www.cannonsecurity.co.uk/Cannonsecuritysurveycomplete.htm#http://www.cannonsecurity.co.uk/Cannonsecurityhome.htm";

$recipient = "jonballdesign@hotmail.com";
$subject = 'Website Customer Survey Form';

$message = "Name: $name \n";
$message .= "Reference Number: $RefNumber \n";
$message .= "Engineers Punctuality: $_questone \n";
$message .= "Comments on engineers punctuality: $punctuality \n";
$message .= "Engineers attitude: $_questtwo \n";
$message .= "Comments of engineers attitude: $attitude \n";
$message .= "Engineers response: $_questthree \n";
$message .= "Comments on engineers response: $engineersresponse \n";
$message .= "Cleanliness: $_questfour \n";
$message .= "Comments on engineers cleanliness: $cleanliness \n";
$message .= "Office Response: $_questfive \n";
$message .= "Comments on office staff telephone response: $officeresponse \n";
$message .= "Office Manner: $_questsix \n";
$message .= "Comments on office staff telephone manner: $officemanner \n";
$message .= "Office Queries: $_questseven \n";
$message .= "Comments on office staff's respone to queries: $officequeries \n";
$message .= "Office Complaints: $_questeight \n";
$message .= "Comments on office staff response to complaints: $officecomplaints \n";
$message .= "Other Comments: $othercomments \n";

$headers = "From: $name";

mail($recipient,$subject,$message,$headers);
header ("Location: $url");

?> //

Take a look at the variables I have bolded, and then take a look at the variable names you have put into the message variables.

JBD
08-06-2007, 12:25 PM
Actually these are the fields which seem to be working ok - as you said it doesn't matter what I name these:

So, add a couple of spaces below the <?php tag and insert the following code:

PHP Code:
$name = $_POST['Name'];
$ref = $_POST['Ref Number'];
$qone = $_POST['_questone'];
The $name, $ref, $qone are all variables and can be named whatever you want.

$_POST['Name']; is telling the page to post whatever data is in the field with the name 'Name'

I am having trouble with the fields which don't say 'test' next to them.

Mark_W
08-06-2007, 12:51 PM
I don't understand how you could have sent the form and the values of the radio buttons showing up in the email.

I did say that you could name the variables whatever you wanted to, but only the variables at the top of the page.

If you name a variable $bob and you want to use the data that is within that variable you have to use $bob where you want it displayed, you cant change the variable to $dave half way down the page. Do you see what I mean?

I have copied the code you have posted up and changed the email address to mine and I got all the data I inserted into the form apart from the radio buttons and the reference number.

Then I changed it to how I feel it should be and it worked perfectly.

This is what I changed.


$message .= "Reference Number: $ref \n";
$message .= "Engineers Punctuality: $question1 \n";

$message .= "Engineers attitude: $question2 \n";

$message .= "Engineers response: $question3 \n";

$message .= "Cleanliness: $question4 \n";

$message .= "Office Response: $question5 \n";

$message .= "Office Manner: $question6 \n";

$message .= "Office Queries: $question7 \n";

$message .= "Office Complaints: $question8 \n";


As you can see those variables now link to the variables at the top.

Try that and tell me what happens

JBD
08-06-2007, 05:08 PM
Now I am even more confused - the radio buttons were working fine for me as each time I received an email the results corresponded with what I had selected on the form. Like I said the only fields which did not work were the comments ones. Having said this I've now changed the code to what you suggested and all results work perfectly. I can't see how, by having the wrong code for the radio buttons, not only still worked (at least for me), but made the comments field not work.

But anyway thanks again Mark for your time and solution to my problem.