Jump to content


Photo

if/ statement doesn't work


  • Please log in to reply
2 replies to this topic

#1 johnwhello

johnwhello
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 13 October 2006 - 09:23 PM

At http://www.michaellobry.com/ are buttons: contact, about us, etc.

Once clicked on one, say: 'contact', i want the current include:
var includingMain = include "HTMLversion_index.php";

change into an 'aboutUs' include as follows:
include "aboutUs.php";

Furthermore i have:
<area onclick="URLforwardProcessingAfterClick();" name="hireMe" shape="rect" coords="400,0,550,100" href="hireMe.php" alt="Hire me" />

And here the PHP function:

function URLforwardProcessingAfterClick() {
if (contact) {
includingMain = include "mailFormInput.php";
else if(aboutUs) {
includingMain = include "aboutUs.php";
else if(sitemap) {
includingMain = include "sitemap.php";
else if(hireMe) {
includingMain = include "hireMe.php";
else if(searching) {
includingMain = include "searching.php";
}}}}}
}

Above script doesn't work. Help!

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 13 October 2006 - 09:28 PM

Are you sure that this is PHP related? Looks more like JavaScript syntax to me...

#3 kanikilu

kanikilu
  • Members
  • PipPip
  • Member
  • 29 posts
  • LocationDallas, TX

Posted 13 October 2006 - 09:43 PM

function URLforwardProcessingAfterClick() {
if (contact) {
   includingMain = include "mailFormInput.php";
   else if(aboutUs) {
      includingMain = include "aboutUs.php";
   else if(sitemap) {
      includingMain = include "sitemap.php";
   else if(hireMe) {
      includingMain = include "hireMe.php";
   else if(searching) {
      includingMain = include "searching.php";
}}}}}
}

If that's supposed to be PHP, you've got some problems. First, it looks like you are trying to use variables (contact, includingMain, aboutUs, etc.) however you didn't preceed them with "$". Next, each of those else if's need to be closed of individually instead of all at the same time like you have it.

For example (I'm assuming that those are variables here):

if ($contact) {
   $includingMain = include "mailFormInput.php";
   else if($aboutUs) {
        $includingMain = include "aboutUs.php";
   } else if($sitemap) {
        $includingMain = include "sitemap.php";
   } else if($hireMe) {
        $includingMain = include "hireMe.php";
   } else if($searching) {
        $includingMain = include "searching.php";
   }
}

...and if that's not supposed to be PHP, I think you have wrong forum ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users