Php script not working

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Php script not working

Post by CesarePlay »

I made a php script and tried modifying one made for me for someone overseas but neither works. After I press send I get a blank page. I am not sure what is causing the problem. Can anyone help?
Image
User avatar
Ron2K
Forum Technical Administrator
Posts: 9050
Joined: 04 Jul 2006, 16:45
Location: Upper Hutt, New Zealand
Contact:

Re: Php script not working

Post by Ron2K »

This may help.

Also, check your webserver's error log file.
Kia kaha, Kia māia, Kia manawanui.
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Php script not working

Post by RuadRauFlessa »

More info would be welcome.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

Hi. I checked everything so that is working but my confirmation page does not come up.
Image
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Php script not working

Post by RuadRauFlessa »

Dude if you don't give more info we can't help. Do you use forms. If so just post some psudo code with the form tags in it. It would at least be a start.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Re: Php script not working

Post by maxxis »

Function of the script?
PHP version on the server?
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

RuadRauFlessa wrote:More info would be welcome.
Here is the code:

<?php
$httpagent = $_POST['httpagent'];
$httpref = $_POST['$httpref'];
$recipient = "wwwnddk@xy.com";
$fullname = $_POST['fullname'];
$idnumber = $_POST['idnumber'];
$Physicaladdress = $_POST['physicaladdress'];
$Postaladdress = $_POST['postaladdress'];
$Telephonehome = $_POST['telephonehome'];
$Telephonework = $_POST['telephonework'];
$Cell = $_POST['Cell'];
$Join = $_POST['Join'];
$From = "www.website.net";
$comments = $_POST['comments'];
$todayis = date("l, F j, Y, g:i a") ;
$subject = "Bill of Animal Rights";

// Page Notification
$notificationPage = "http://www.website.net/Confirmation.htm";

$message = "Today's date is: $todayis";
$message = "\r\n";
$message = "Name: $fullname";
$message = "\r\n";
$message .= "ID Number: $idnumber";
$message = "\r\n";
$message .= "Physical Address: $Physicaladdress";
$message = "\r\n";
$message .= "Postal Address: $Postaladdress";
$message = "\r\n";
$message .= "Telephone (home): $Telephonehome";
$message = "\r\n";
$message .= "Telephone (work): $Telephonework";
$message = "\r\n";
$message .= "Cell Number: $Cell";
$message = "\r\n";
$message .= "Join ABVP Law?: $Join";
$message = "\r\n";
$message .= "Comments: $comments ";

mail($recipient,$subject,$message,$From);

// Notification
$exit_location = "Location: ".$notificationPage;
header($exit_location);
?>

I need the confirmation page to come up and from the website address
Image
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

maxxis wrote:Function of the script?
PHP version on the server?

Hi. It has to send information regarding a persons details to the web company about a bill. I used a earlier script and that worked perfectly but this one does not. Once it is working I can then add validation code to it.

For what the page sends: here is the site page: contact page that does not to function correctly
Image
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Re: Php script not working

Post by maxxis »

Link doesn't work
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

Ok. Here is the link: www.legalworx.net/contact2.htm

I now getting the confirmation page but all the text is on one line and I getting am not getting the from that I defined
Image
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Re: Php script not working

Post by maxxis »

post the actual code of bvp2.php please

use [c o d e] tags
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

maxxis wrote:post the actual code of bvp2.php please

use [c o d e] tags
Ok.

Code: Select all


<?php
$httpagent = $_POST['httpagent'];
$httpref = $_POST['$httpref'];
$recipient = "xyz@zy.com";
$fullname = $_POST['fullname'];
$idnumber = $_POST['idnumber'];
$Physicaladdress = $_POST['physicaladdress'];
$Postaladdress = $_POST['postaladdress'];
$Telephonehome = $_POST['telephonehome'];
$Telephonework = $_POST['telephonework'];
$Cell = $_POST['Cell'];
$Join = $_POST['Join'];
$From = "www.website.net";
$comments = $_POST['comments'];
$todayis = date("l, F j, Y, g:i a") ;
$subject = "Bill of Animal Rights";

$message = "Today's date is: $todayis";
$message = "Name: $fullname";
$message .= "ID Number: $idnumber";
$message .= "Physical Address: $Physicaladdress";
$message .= "Postal Address: $Postaladdress";
$message .= "Telephone (home): $Telephonehome";
$message .= "Telephone (work): $Telephonework";
$message .= "Cell Number: $Cell";
$message .= "Join ABVP Law?: $Join";
$message .= "Comments: $comments";

mail($recipient,$subject,$message,$From);

// Page Notification
$notificationPage	= "http://www.website.htm";

// Notification
$exit_location = "Location: ".$notificationPage;
header($exit_location);
?> 

Image
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

The big problem now is I can't get the lines to appear one under the other and the from is wrong.
Image
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Re: Php script not working

Post by maxxis »

Your $notificationPage = "http://www.website.htm"; is completely wrong.

That should be the final destination URL.
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Php script not working

Post by RuadRauFlessa »

should propably be

Code: Select all

$notificationPage = "http://www.website.net/Confirmation.htm";
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

RuadRauFlessa wrote:should propably be

Code: Select all

$notificationPage = "http://www.website.net/Confirmation.htm";

I got it like that. I just edited out wrong.

How do I get my information to under neatly and easy to read because it is all appearing on one line.
Image
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

maxxis wrote:Your $notificationPage = "http://www.website.htm"; is completely wrong.

That should be the final destination URL.

Sorry about that. I edited it wrong. I got it correct on ythe online script. Can you help with the display of the information? It is all on one line now. :?
Image
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Re: Php script not working

Post by maxxis »

Looks like the whole processor page is wrong.

CP. Did you even edit the page to make sure all the form fields are linking correctly and that the recipients etc are correct?
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

maxxis wrote:Looks like the whole processor page is wrong.

CP. Did you even edit the page to make sure all the form fields are linking correctly and that the recipients etc are correct?
Yes. They are. It is working now except the display part. I getting the info on one line.
Image
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Re: Php script not working

Post by maxxis »

Code: Select all

$message = "Today's date is: $todayis";
$message = "\r\n";
$message .= "Name: $fullname";
$message .= "\r\n";
$message .= "ID Number: $idnumber";
$message .= "\r\n";
$message .= "Physical Address: $Physicaladdress";
$message .= "\r\n";
$message .= "Postal Address: $Postaladdress";
$message .= "\r\n";
$message .= "Telephone (home): $Telephonehome";
$message .= "\r\n";
$message .= "Telephone (work): $Telephonework";
$message = "\r\n";
$message .= "Cell Number: $Cell";
$message .= "\r\n";
$message .= "Join ABVP Law?: $Join";
$message .= "\r\n";
$message .= "Comments: $comments ";
Replace the existing bit with that
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

CesarePlay wrote:
maxxis wrote:Looks like the whole processor page is wrong.

CP. Did you even edit the page to make sure all the form fields are linking correctly and that the recipients etc are correct?
Yes. They are. It is working now except the display part. I getting the info on one line.
Here is how it comes to me:

www.legalworx.net

Name: CesareID Number: 8108275008087Physical Address: 56 Jan Smuts AvenuePostal Address: 219969866Telephone (home): Telephone (work): Cell Number: Join ABVP Law?: YesComments: test
Image
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

maxxis wrote:

Code: Select all

$message = "Today's date is: $todayis";
$message = "\r\n";
$message .= "Name: $fullname";
$message .= "\r\n";
$message .= "ID Number: $idnumber";
$message .= "\r\n";
$message .= "Physical Address: $Physicaladdress";
$message .= "\r\n";
$message .= "Postal Address: $Postaladdress";
$message .= "\r\n";
$message .= "Telephone (home): $Telephonehome";
$message .= "\r\n";
$message .= "Telephone (work): $Telephonework";
$message = "\r\n";
$message .= "Cell Number: $Cell";
$message .= "\r\n";
$message .= "Join ABVP Law?: $Join";
$message .= "\r\n";
$message .= "Comments: $comments ";
Replace the existing bit with that
Thanks. I will do that. How do I fix the "From" part. It says from anonymous
Image
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Re: Php script not working

Post by maxxis »

Change $From = "www.website.net"; to $From = $_POST['email'];

I would recommend you capture the email address on the form.
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

Ok. I will convince the guy to do have it in the form.
Image
CesarePlay
Registered User
Posts: 10628
Joined: 26 Mar 2007, 02:00
Location: In the river of thoughts
Contact:

Re: Php script not working

Post by CesarePlay »

Ok. the form works but now I need to add validation to the fields. Where is the best website for this?
Image
Post Reply