Page 2 of 3

Posted: Wed Jan 29, 2003 3:19 am
by twigletmac
What are the errors?

Mac

Posted: Wed Jan 29, 2003 4:38 am
by Bjarnat
Hi Mac,

If you don't mind please visit the followin url

http://ski.voices-of-europe.de/checkout.php

once you finish the form just click at the "missing" image directly under the "comments"

Thanks for your help again!

Posted: Wed Jan 29, 2003 4:54 am
by Bjarnat
Sorry!

The link to the page should be as follows:

http://ski.voices-of-europe.de/checkouten.htm

Posted: Wed Jan 29, 2003 5:11 am
by twigletmac
Have you created a header and footer and put the paths to these in $header and $footer, ie, here:

Code: Select all

$header = "header.html"; 
$footer = "footer.html";
Mac

Posted: Wed Jan 29, 2003 5:15 am
by twigletmac
Actually having looked at the code again there doesn't seem to be any passing of these variables, for example, this function:

Code: Select all

function doFormError($errString) { 

include($header); 

echo "<FONT SIZE=+2>The form you submitted was not complete.<BR><BR></FONT>"; 
echo "$errString<BR><BR>\n"; 
echo "<INPUT TYPE=BUTTON ONCLICK='history.back()' VALUE=' Return to the checkout page '><HR>"; 

include($footer); 

exit; 
}
should have an additional line added underneath the function definition:

Code: Select all

function doFormError($errString) {
    global $header, $footer; // without this the function can't use these variables
The same problem occurs in the doError function too.

Mac

Posted: Wed Jan 29, 2003 5:18 am
by twigletmac
Finally, try adding the following:

Code: Select all

extract($_POST);
above this line:

Code: Select all

if (($b_first == "") || ($b_last == "") || ($b_addr == "") ||
 ($b_city == "") || ($b_state == "") || ($b_zip == "") || 
($b_phone == "") || ($b_email == "")) {
Mac

Posted: Wed Jan 29, 2003 7:03 am
by Bjarnat
Hi Mac,

Thanks for your time.

I did includ the first piece of code

global $header, $footer;

and now I am only getting the that my form was incomplete, although I filled in everything!?

As per the other code that you suggested I should include, can you tell me where in the code these should go?

Thanks!!!

Posted: Wed Jan 29, 2003 7:08 am
by twigletmac
Put it above the line I indicated beneath the big block of comments that looks like this:

Code: Select all

//############################################################## 
//############################################################## 
//### MAIN ### 
//############################################################## 
//##############################################################
Mac

Posted: Wed Jan 29, 2003 7:44 am
by Bjarnat
Yes, I did that and now I get the following

Parse error: parse error, unexpected $ in /home/www/voices-of-europe.de/subs/ski/htdocs/checkout.php on line 393


????

Posted: Wed Jan 29, 2003 8:14 am
by twigletmac
Could you post the 5 lines of code above and below the line you added (as well as the line of course).

Mac

Posted: Wed Jan 29, 2003 8:42 am
by Bjarnat
Hi Mac

below you'll find complete lines

Thanks!

Posted: Wed Jan 29, 2003 8:43 am
by Bjarnat
function doFormError($errString) {

global $header, $footer;


include($header);

echo "<FONT SIZE=+2>The form you submitted was not complete.<BR><BR></FONT>";
echo "$errString<BR><BR>\n";
echo "<INPUT TYPE=BUTTON ONCLICK='history.back()' VALUE=' Return to the checkout page '><HR>";

include($footer);

exit;
}

Posted: Wed Jan 29, 2003 8:43 am
by Bjarnat
if (($b_first == "") || ($b_last == "") || ($b_addr == "") ||
($b_city == "") || ($b_state == "") || ($b_zip == "") ||
($b_phone == "") || ($b_email == "")) {


extract($_POST);




if (($b_first == "") || ($b_last == "") || ($b_addr == "") || ($b_city == "") || ($b_state == "") || ($b_zip == "") || ($b_phone == "") || ($b_email == "")) {
doFormError("I'm sorry, but it appears that you forgot to fill in a required field. Please go <A HREF='Javascript:history.go(-1);'>back</A> and correct the error.");
exit;
}

//# checks for valid email address
if( !(ereg("^(.+)@(.+)\\.(.+)$",$b_email)) ) {
doFormError("You submitted an invalid email address. Please go <A HREF='Javascript:history.go(-1);'>back</A> and correct the error.");
exit;
}

Posted: Wed Jan 29, 2003 8:48 am
by Bjarnat
Just a question. Would this have anything to do with the following:


in my checkout form I have a postal code first where a state is

and a coutry where a zip is

in php form ???

Posted: Wed Jan 29, 2003 9:22 am
by twigletmac
You need to remove this:

Code: Select all

if (($b_first == "") || ($b_last == "") || ($b_addr == "") || 
($b_city == "") || ($b_state == "") || ($b_zip == "") || 
($b_phone == "") || ($b_email == "")) {
from above

Code: Select all

extract($_POST);
sorry that was the line from your code I was trying to indicate that the extract() line should be placed above.

Mac