jblayney
asked on
thank you page for mutiple forms
hello,
i am creating a thank you page which will be used for all 4 forms on this website, So i want it to display a custom thank you for each page it comes from. So far i have 2 of the pages going to it, and I am getting no results (blank page) and no email.
$page is a hidden field that is on both pages and it is all in a table.
any help would be appreciated, remember i will need to add 2 more ifs after this
<td width="335" valign="top">
<?
if($page == "contact") Then
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for your feedback\n";
$msg .= "If you require a response you will\n";
$msg .= "receive one within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Contact Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma ilheaders) ;
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com" ; // ** this is the customer service dept. **
$subject = "Web site contact form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma ilheaders) ;
// ********* end of customer support email ************
echo "<h1>Thank you for contacting us.</h1><p>If you require a response we will return one to you within 2 - 3 business days.</p>"
Else
if($page == "volunteer") Then
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for offering to volunteer\n";
$msg .= "We will response to you\n";
$msg .= "within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Volunteer Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma ilheaders) ;
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Phone :$phone\n";
$msg .= "Best time to call :$time\n";
$msg .= "Workshops :$workshops\n";
$msg .= "Mentorship :$mentorship\n";
$msg .= "Training :$Training\n";
$msg .= "Job :$job\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com" ; // ** this is the customer service dept. **
$subject = "Web site Volunteer form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma ilheaders) ;
// ********* end of customer support email ************
echo "<h1>Thank you for volunteering.</h1><p>We will try to response to you within 2 - 3 business days.</p>"
End If
?>
</td>
i am creating a thank you page which will be used for all 4 forms on this website, So i want it to display a custom thank you for each page it comes from. So far i have 2 of the pages going to it, and I am getting no results (blank page) and no email.
$page is a hidden field that is on both pages and it is all in a table.
any help would be appreciated, remember i will need to add 2 more ifs after this
<td width="335" valign="top">
<?
if($page == "contact") Then
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for your feedback\n";
$msg .= "If you require a response you will\n";
$msg .= "receive one within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Contact Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com"
$subject = "Web site contact form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma
// ********* end of customer support email ************
echo "<h1>Thank you for contacting us.</h1><p>If you require a response we will return one to you within 2 - 3 business days.</p>"
Else
if($page == "volunteer") Then
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for offering to volunteer\n";
$msg .= "We will response to you\n";
$msg .= "within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Volunteer Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Phone :$phone\n";
$msg .= "Best time to call :$time\n";
$msg .= "Workshops :$workshops\n";
$msg .= "Mentorship :$mentorship\n";
$msg .= "Training :$Training\n";
$msg .= "Job :$job\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com"
$subject = "Web site Volunteer form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma
// ********* end of customer support email ************
echo "<h1>Thank you for volunteering.</h1><p>We will try to response to you within 2 - 3 business days.</p>"
End If
?>
</td>
ASKER
this too
if($page == "contact") Then {
bla
} else {
if($page == "volunteer") Then {
bla bla
} }
end if
(added braces)
if($page == "contact") Then {
bla
} else {
if($page == "volunteer") Then {
bla bla
} }
end if
(added braces)
ASKER
should I stick these in functions at the top
if($page == "contact") Then {
function ("contact")
} else {
if($page == "volunteer") Then {
function ("volunteer")
} }
if($page == "contact") Then {
function ("contact")
} else {
if($page == "volunteer") Then {
function ("volunteer")
} }
ASKER
Ok,
Sorry about this, I just changed more, ths is the code now
<?php
if($_REQUEST['page'] == "contact") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for your feedback\n";
$msg .= "If you require a response you will\n";
$msg .= "receive one within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Contact Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma ilheaders) ;
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com" ; // ** this is the customer service dept. **
$subject = "Web site contact form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma ilheaders) ;
// ********* end of customer support email ************
echo "<h1>Thank you for contacting us.</h1><p>If you require a response we will return one to you within 2 - 3 business days.</p>"
} Else {
if($_REQUEST['page'] == "volunteer") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for offering to volunteer\n";
$msg .= "We will response to you\n";
$msg .= "within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Volunteer Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma ilheaders) ;
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Phone :$phone\n";
$msg .= "Best time to call :$time\n";
$msg .= "Workshops :$workshops\n";
$msg .= "Mentorship :$mentorship\n";
$msg .= "Training :$Training\n";
$msg .= "Job :$job\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com" ; // ** this is the customer service dept. **
$subject = "Web site Volunteer form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma ilheaders) ;
// ********* end of customer support email ************
echo "<h1>Thank you for volunteering.</h1><p>We will try to response to you within 2 - 3 business days.</p>"
}}
End If
?>
Sorry about this, I just changed more, ths is the code now
<?php
if($_REQUEST['page'] == "contact") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for your feedback\n";
$msg .= "If you require a response you will\n";
$msg .= "receive one within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Contact Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com"
$subject = "Web site contact form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma
// ********* end of customer support email ************
echo "<h1>Thank you for contacting us.</h1><p>If you require a response we will return one to you within 2 - 3 business days.</p>"
} Else {
if($_REQUEST['page'] == "volunteer") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for offering to volunteer\n";
$msg .= "We will response to you\n";
$msg .= "within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Volunteer Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Phone :$phone\n";
$msg .= "Best time to call :$time\n";
$msg .= "Workshops :$workshops\n";
$msg .= "Mentorship :$mentorship\n";
$msg .= "Training :$Training\n";
$msg .= "Job :$job\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com"
$subject = "Web site Volunteer form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma
// ********* end of customer support email ************
echo "<h1>Thank you for volunteering.</h1><p>We will try to response to you within 2 - 3 business days.</p>"
}}
End If
?>
ASKER
no comments,
is this really that hard, or is everyone out enjoying the good weather ?
is this really that hard, or is everyone out enjoying the good weather ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks VGR
I tried , request, get and post with this
echo $_POST['page']."<BR>"; exit;
I'm still gettiing the same result, a blank page, after a bit of thinking
I tried , request, get and post with this
echo $_POST['page']."<BR>"; exit;
I'm still gettiing the same result, a blank page, after a bit of thinking
ASKER
and register globals is on,
I have many sites hosted on this server that use php, and the $_REQUEST works with them ????
I have many sites hosted on this server that use php, and the $_REQUEST works with them ????
ASKER
and you right about it being sunady, and a beautiful one at that, Ihave watched a foot of snow melt off my back porch today, What am i doing inside ???
if register_global in On (good :D ) and your calling FORM has a hidden field names 'page', just use $page in the receiving script...
Anyway, trying your script with "echo $_POST['page']."<BR>"; exit;" SHOULD HAVE DISPLAYED SOMETHING ( at least the <BR> ;-)
Try with $page
echo "page received is '$page'<BR>"; exit;
Anyway, trying your script with "echo $_POST['page']."<BR>"; exit;" SHOULD HAVE DISPLAYED SOMETHING ( at least the <BR> ;-)
Try with $page
echo "page received is '$page'<BR>"; exit;
ASKER
ok
i stripped out all php except echo $page, and it displayed the correct word, so the varable is getting passed, what do you think, Is it some stupid syntax error or somerthing ? I can't find any.
i stripped out all php except echo $page, and it displayed the correct word, so the varable is getting passed, what do you think, Is it some stupid syntax error or somerthing ? I can't find any.
ASKER
ok,
i stripped out the if staement, and have it just for the contact page, And it works and the emails are sent, so the proble is the "IF" statement, any advice on a better way to write it?
i stripped out the if staement, and have it just for the contact page, And it works and the emails are sent, so the proble is the "IF" statement, any advice on a better way to write it?
ASKER
What about if I named the form itself. I've never done that before, how would that work ?
Of course what I can do , is make 4 copies of the thank you page, one for each form. but..... i was hoping to do something more elegant.
Of course what I can do , is make 4 copies of the thank you page, one for each form. but..... i was hoping to do something more elegant.
ASKER
Im trying to put this whole thing in a function, and put it in an include file, but its not working.
function contact()
{
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
bla bla bla
send email code
}
that seems straight forward, but in the other page when I call it, it doesn't work
<?php include("mail.php"); ?>
<?
contact():
?>
this is what I'm doing. I'm then hoping to use this with my "IF" statement,
if($_REQUEST['page'] == "contact") Then
{
contact():
} else {
and so on, I know this is getting bigger, but i really dont want to have 4 separate pages.
function contact()
{
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
bla bla bla
send email code
}
that seems straight forward, but in the other page when I call it, it doesn't work
<?php include("mail.php"); ?>
<?
contact():
?>
this is what I'm doing. I'm then hoping to use this with my "IF" statement,
if($_REQUEST['page'] == "contact") Then
{
contact():
} else {
and so on, I know this is getting bigger, but i really dont want to have 4 separate pages.
ASKER
can anyone at least tell me if I'm on the right track, this all seems straight forward, but my "IF"'s and functions just wont work
NO
IT'S WORSE FOR YOU
WHY ?
Because globals are to be re-declared as GLOBAL in a function scope...
Stick with your first code, the echo $page worked (normal) so now you know how to access your variables. I'll help you.
ANYWAY, WHEN I SAY "echo "$page<BR>"; exit;" I DON'T UNDERSTAND WHY YOU "strip everything but echo $page" : WHAT is the EXIT; for in your opirnion ???
IT'S WORSE FOR YOU
WHY ?
Because globals are to be re-declared as GLOBAL in a function scope...
Stick with your first code, the echo $page worked (normal) so now you know how to access your variables. I'll help you.
ANYWAY, WHEN I SAY "echo "$page<BR>"; exit;" I DON'T UNDERSTAND WHY YOU "strip everything but echo $page" : WHAT is the EXIT; for in your opirnion ???
here is you code. I added some //### comments
<?php
session_start(); //#don't forget this
//## remember that even with register_globals=On, it should be better to use $page=$_GET['page'] if the calling FORM is in method=GET, etc
if($page=="contact") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for your feedback\n";
$msg .= "If you require a response you will\n";
$msg .= "receive one within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Contact Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma ilheaders) ;
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com" ; // ** this is the customer service dept. **
$subject = "Web site contact form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma ilheaders) ;
// ********* end of customer support email ************
echo "<h1>Thank you for contacting us.</h1><p>If you require a response we will return one to you within 2 - 3 business days.</p>"
} else if ($page=="volunteer") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for offering to volunteer\n";
$msg .= "We will response to you\n";
$msg .= "within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Volunteer Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma ilheaders) ;
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Phone :$phone\n";
$msg .= "Best time to call :$time\n";
$msg .= "Workshops :$workshops\n";
$msg .= "Mentorship :$mentorship\n";
$msg .= "Training :$Training\n";
$msg .= "Job :$job\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com" ; // ** this is the customer service dept. **
$subject = "Web site Volunteer form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma ilheaders) ;
// ********* end of customer support email ************
echo "<h1>Thank you for volunteering.</h1><p>We will try to response to you within 2 - 3 business days.</p>"
} // else case not covered
//# I would recommend :
//- a switch($page) statement
//- to check that the calling FORM is in a script with session_start(); at the beginning
//- to generate proper HTML (HTML,HEAD,TITLE,/TITLE,/H EAD,BODY,/ BODY,/HTML etc)
//- to put the mailing calls in a function to clear&simplify a bit the code 8-)
?>
<?php
session_start(); //#don't forget this
//## remember that even with register_globals=On, it should be better to use $page=$_GET['page'] if the calling FORM is in method=GET, etc
if($page=="contact") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for your feedback\n";
$msg .= "If you require a response you will\n";
$msg .= "receive one within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Contact Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com"
$subject = "Web site contact form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma
// ********* end of customer support email ************
echo "<h1>Thank you for contacting us.</h1><p>If you require a response we will return one to you within 2 - 3 business days.</p>"
} else if ($page=="volunteer") Then {
// ********* reply email customer support ************
$msg = "E-Mail SEND FROM http://www.lccw.ca\n";
$msg .= "Dear $realname :\n\n";
$msg .= "We have received your email\n\n";
$msg .= "Thank you for offering to volunteer\n";
$msg .= "We will response to you\n";
$msg .= "within 2 - 3 business days";
$to = "$email"; // **** to form filler ********
$subject = "Life Choices for Women & Children: Volunteer Confirmation\n";
$mailheaders = "From: jplummer@lccw.ca\n";
$mailheaders .= "Reply-To: jplummer@lccw.ca";
mail($to,$subject,$msg,$ma
// ****** end of reply email *********
// ******** start of email to customer support **********
$msg = "Name :$realname\n";
$msg .= "Email :$email\n";
$msg .= "Phone :$phone\n";
$msg .= "Best time to call :$time\n";
$msg .= "Workshops :$workshops\n";
$msg .= "Mentorship :$mentorship\n";
$msg .= "Training :$Training\n";
$msg .= "Job :$job\n";
$msg .= "Message :$message\n";
$to = "justin@justinblayney.com"
$subject = "Web site Volunteer form\n";
$mailheaders = "From: $realname\n";
$mailheaders .= "Reply-To: $email";
mail($to,$subject,$msg,$ma
// ********* end of customer support email ************
echo "<h1>Thank you for volunteering.</h1><p>We will try to response to you within 2 - 3 business days.</p>"
} // else case not covered
//# I would recommend :
//- a switch($page) statement
//- to check that the calling FORM is in a script with session_start(); at the beginning
//- to generate proper HTML (HTML,HEAD,TITLE,/TITLE,/H
//- to put the mailing calls in a function to clear&simplify a bit the code 8-)
?>
ASKER
"ANYWAY, WHEN I SAY "echo "$page<BR>"; exit;" I DON'T UNDERSTAND WHY YOU "strip everything but echo $page" : WHAT is the EXIT; for in your opirnion ???"
unfortunatly, I had to do that, I know what exit means, but for some reason the If after it was messing it up.
????? I dont know why ??????
but when I have a problem , one of the ways I troubleshoot it is too keep stripping code until it works. so I can see where the problem starts
unfortunatly, I had to do that, I know what exit means, but for some reason the If after it was messing it up.
????? I dont know why ??????
but when I have a problem , one of the ways I troubleshoot it is too keep stripping code until it works. so I can see where the problem starts
yes. Why not :D
I'll recommend building your script from control structures up ; this way you'll never have "an if messing [things] up"
have you tried my humble suggestion ?
I'll recommend building your script from control structures up ; this way you'll never have "an if messing [things] up"
have you tried my humble suggestion ?
Have u ever seen THEN in if statement in PHP? I didn't and it gives me a parse error. U should put THEN after if away.
oh yes, true 8-)
I missed that one 8-)
I missed that one 8-)
ASKER
"Have u ever seen THEN in if statement in PHP? I didn't and it gives me a parse error. U should put THEN after if away"
HUH ?????
Anyways, I'm sorry I'm taking so long with this. for a quick fix I made a different thank you/email send page. I will be coming back to this, But right now i am too busy. So please be patient.
HUH ?????
Anyways, I'm sorry I'm taking so long with this. for a quick fix I made a different thank you/email send page. I will be coming back to this, But right now i am too busy. So please be patient.
he wrote that the syntax in PHP ressembles the C one :
if (test) { // start then case
} else { // start else case
} // end of if
or
if (test)
{ // start then case
}
else { // start else case
} // end of if
And not like this (in Pascal)
if test
then begin // then case
end
else begin // else case
end; // end of if test
Except that the parentheses are mandatory around a logical test in PHP, whereas they shouldn't in a real language (like Pascal)
if (test) { // start then case
} else { // start else case
} // end of if
or
if (test)
{ // start then case
}
else { // start else case
} // end of if
And not like this (in Pascal)
if test
then begin // then case
end
else begin // else case
end; // end of if test
Except that the parentheses are mandatory around a logical test in PHP, whereas they shouldn't in a real language (like Pascal)
Sorry for that short bad-looking answer. But I had my keyboard broken and wrote it through Windows Character Map. So it should be short and exact.
Anyway, this is what I mean:
bad code = if(something happens) then {do something};
good one = if(something happens) {do something};
... so no THEN should be written after "if".
Hope u understand now ;o)
regards
Anyway, this is what I mean:
bad code = if(something happens) then {do something};
good one = if(something happens) {do something};
... so no THEN should be written after "if".
Hope u understand now ;o)
regards
ASKER
<?php
and had no luck
i also tried
if($page == "contact") Then {
bla
} else {
bla bla
} end if
(added braces)
that didn't help either