I have another problem with the design of my website.
I have build a form and have done some coding (copying from another one and trying to follow the logic as I am not a proprammer).
I do realise that when I am on line 15, Dreamwever itself indicates the line but I do not know what is wrong with it.
I get this message when I submit my form;
Parse error: syntax error, unexpected T_VARIABLE in /websites/123reg/LinuxPackage21/pc/ho/me/pchometech.co.uk/public_html/thank_you.php on line 15
This is what I have written in my php page;
<?php
$to = $_REQUEST['query'];
$from = $_REQUEST['email'];
$name = $_REQUEST['f_name'];
$headers = "From: $from";
$subject = "Web Contact Data.";
$fields = array ();
$fields{"Name"} = "Name";
$headers2 = "From: [email]noreply@company.com[/email]";
$subject2 = "Thank you for contacting us.";
$autoreply = "Thank you for contacting us. We will get back to you as soon as possible, usualy within 6 hours. If you have any more questions, please consult our website at [Company.com](http://www.company.com). kind regards, Customer Care Dep."
$body ="We have received the following information:\
\
"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\
",$b,$_REQUEST[$a]); }
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
?>
I have more fields to includ on it but for now I am just trying to get it to work.
Any help or comments about it are really appreciated.
To my previous html post, I extend my gratitude to all of those who helped.
Thanks.
Many thanks for the fast replys and all the help provided within.
Now the form is working and sending the data away to an e-mail account accordingly to the query type selected.
One thing I wanted to do is to includ the initial, first and last name on the body answer to the customer as like;
Dear {Title}{First Name}{Last Name};
Thank you for contacting us…
Can this be done with PHP?
Again, any help well apprecited.
By the way, I have this sort of thing included now on the thank_you.php page but when I tried to include it on the body message of the autoreply Dreamwever reported as line being in error.
Yes it can be done but you need to collect that information from your form. It’s done like this:
“Dear $Title $First $Last”
Like I said, you need to get those details from your form though so if you don’t have a first and last name text box you’re not going to be able to get their names from anywhere.
My Title, First and Last Name fields are as follow;
title
f_name
l_name
.
I have done as sugested but I get the e-mail as only Dear, and nothing comes through.
<?php
$to = $_REQUEST['query'];
$from = $_REQUEST['email'];
$name = $_REQUEST['f_name'];
$headers = "From: $from";
$subject = "Web Contact Data.";
$fields = array ();
$fields{"f_name"} = "First Name";
$fields{"l_name"} = "Last Name";
$headers2 = "From: [email]noreply@company.co.uk[/email]";
$subject2 = "Thank you for contacting us.";
$autoreply = "Dear $title $f_name $l_name,
Thank you for contacting us.
We will get back to you as soon as possible, usualy within 6 hours.
If you have any more questions, please consult our website at [Company](http://www.company.co.uk).
kind regards,
Customer Care Dep.";
$body ="We have received the following information:\
\
"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\
",$b,$_REQUEST[$a]); }
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
?>
I have bumped into a form that I have downloaded and have deleted it somehow.
This form would do something quite useful.
On sendig the e-mail booth to the customer and to us, it would includ on the bottom of the boddy message the customers IP address, date and time and and ID number generated somehow.
How can I includ these? I have googled ever since for this of the form I got this so that I could have a peak at the code but could not fid it.
Any help, as before, well appreciated you guys and girls.
It’s not the form that generates that. You want to look at $_SERVER and specifically $_SERVER[‘REMOTE_ADDR’] which is the visitors IP address. Time and date you can work out using google, and ID number is almost certainly the auto_increment id of a mysql database table. You get the id of the inserted record by using mysql_insert_id()
In 15 years of IT I have never dealt with databases ever.
I have just checked with my hosting provider and yes, I can have up to 2 databases.
I have just created one and from now onwards I am clueless as to what to do. I have managed to go as far as creat a table which I believe I will have to right?
Any help with matter is trully apprecited as this is right over my head I’m afraid.
Cheers you guys.
I’ll be back tomorrow and most defenatelly will be Googling away. It seems that I can no longer run away from Google and forums on a daily basis now. I just want to finish this website.
Basically think of a table as a spreadsheet. Each column has a name but importantly it also has a datatype (which in a spreadsheet you can do to by right clicking on the column header and selecting its type).
The difference being with a database you can have multiple tables and there is a good reason for that. You can setup a relational database and then link records from several tables together. Initially it sounds very daunting but once you’ve got the hang of it you’ll be fine and you’ll wonder how you ever managed without them.
Far superior to using text files for storing data.
I was always self-employed doing the occasional works here and there.
Worked in Portugal mainly for schools on the network side of things and yeah, there was a database but nothing complicated. Just install the application on the server side and clients to keep records for every student like grades, attendance, establish the connection between clients and server etc… And I did not have anything to do with the database once it was up and running.
Been on the UK for the past 9 years and trying to step into the IT industry but that has proven to be quite hard.
I have done a Cisco qualification (CCNA) to which I have 1 more year remaining on my certification. I am planning on recertifying to the next level CCNP.
Even though I have not been employed on IT field, I do the occasional computer repair here and there and design and deploy small to medium networks whenever I have the chance to do it.
Anyways, I shall have a go at this MySQL thing and hope that I can count with you guys as, like I have said before, I am clueless to what to do next.
Going to work now.
Kind regards,
A very nice day to you all nice people.
Albert, C
Yes getting into IT here in the UK is very hard. I’ve been trying for years and unless you’ve got multiple bits of paper that say qualified no-one wants to know. I’ve seen support desk jobs advertised that want you to have a degree - for £12k!
Then you get people like my cousin… started for a small company putting networks together and got very lucky with 0 qualifications now working as a java programmer earning just under £50K. No idea how these people have such luck but I wish they’d give me some!