p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: My first PHP form...HELP!


Message #1 by "Jay" <jay_connolly@y...> on Sun, 9 Feb 2003 16:15:55
This is the first PHP code for this page I have made.: 
(http://www.webdesignabc.com/base/contact.html ). Can someone please 
help, what is wrong with the php code for this page.

<?mail("email@e...",header( "Location:thankyou.html")$con_name=$_POST
['name'];$con_address=$_POST['address'];$con_postcode=$_POST
['postcode'];$con_telno=$_POST['telno'];$con_email=$_POST
['email'];$con_area=$_POST['area'];$con_location=$_POST
['location'];$con_bedrooms=$_POST['bedrooms'];$con_bathrooms=$_POST
['bathrooms'];$con_prop_type=$_POST['prop_type'];$con_price=$_POST
['price'];$con_add_info=$_POST['add_info'];$con_timeframe=$_POST
['timeframe'];//mail(email@e...)
($con_name,$con_address,$con_postcode,$con_telno,$con_email,$con_area,$con
_location,$con_bedrooms,$con_bathrooms,$con_prop_type,$con_price,$con_add_
info,$con_timeframe)?>

I keep getting this error message...:Parse error: parse error, unexpected 
T_VARIABLE in /home/virtual/site115/fst/var/www/html/base/template.php on 
line 1

I know it is very wrong but if someone can tell me where  I am going 
wrong I will learn.

I would really appreciate it if someone could help. Thanks.
Message #2 by "Bernard Chiu" <admiral_chiu@h...> on Sun, 9 Feb 2003 23:52:32
Try alternating single quote and double quote and see if it makes a 
different.

Also, trying to put \ in front of the double quote to see if there is any 
difference as well.

For future reference, you might want to break the string down into 
different lines for easier debugging...

> 
T> his is the first PHP code for this page I have made.: 
(> http://www.webdesignabc.com/base/contact.html ). Can someone please 
h> elp, what is wrong with the php code for this page.

> <?mail("email@e...",header( "Location:thankyou.html")
$con_name=$_POST
[> 'name'];$con_address=$_POST['address'];$con_postcode=$_POST
[> 'postcode'];$con_telno=$_POST['telno'];$con_email=$_POST
[> 'email'];$con_area=$_POST['area'];$con_location=$_POST
[> 'location'];$con_bedrooms=$_POST['bedrooms'];$con_bathrooms=$_POST
[> 'bathrooms'];$con_prop_type=$_POST['prop_type'];$con_price=$_POST
[> 'price'];$con_add_info=$_POST['add_info'];$con_timeframe=$_POST
[> 'timeframe'];//mail(email@e...)
(> 
$con_name,$con_address,$con_postcode,$con_telno,$con_email,$con_area,$con
_> 
location,$con_bedrooms,$con_bathrooms,$con_prop_type,$con_price,$con_add_
i> nfo,$con_timeframe)?>

> I keep getting this error message...:Parse error: parse error, 
unexpected 
T> _VARIABLE in /home/virtual/site115/fst/var/www/html/base/template.php 
on 
l> ine 1

> I know it is very wrong but if someone can tell me where  I am going 
w> rong I will learn.

> I would really appreciate it if someone could help. Thanks.
Message #3 by "Nikolai Devereaux" <yomama@u...> on Tue, 11 Feb 2003 10:35:41 -0800
> <?mail("email@e...",header( "Location:thankyou.html")$con_name=$_POST
> ['name'];$con_address=$_POST['address'];$con_postcode=$_POST
> ['postcode'];$con_telno=$_POST['telno'];$con_email=$_POST
> ['email'];$con_area=$_POST['area'];$con_location=$_POST
> ['location'];$con_bedrooms=$_POST['bedrooms'];$con_bathrooms=$_POST
> ['bathrooms'];$con_prop_type=$_POST['prop_type'];$con_price=$_POST
> ['price'];$con_add_info=$_POST['add_info'];$con_timeframe=$_POST
> ['timeframe'];//mail(email@e...)
> ($con_name,$con_address,$con_postcode,$con_telno,$con_email,$con_area,$con
> _location,$con_bedrooms,$con_bathrooms,$con_prop_type,$con_price,$con_add_
> info,$con_timeframe)?>
>
> I keep getting this error message...:Parse error: parse error, unexpected
> T_VARIABLE in /home/virtual/site115/fst/var/www/html/base/template.php on
> line 1
>
> I know it is very wrong but if someone can tell me where  I am going
> wrong I will learn.
>
> I would really appreciate it if someone could help. Thanks.

Well, break up your code so that's readable!  That's key.

<?
mail("email@e...",
      header("Location:thankyou.html")$con_name=$_POST['name'];


I already see a problem.

First of all, why are you calling header() and passing the return value as the
2nd parameter to mail()?

Also, you didn't separate the function call to header() and the next value,
$con_name = $_POST['name'].

Also, $con_name=$_POST['name']; ends with a semicolon, but you don't have any
closing parenthesis (or semicolon) for your function call to mail().


Take care,

nik


  Return to Index