Jump to content

Archived

This topic is now archived and is closed to further replies.

johnwhello

if/ statement doesn't work

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Are you sure that this is PHP related? Looks more like JavaScript syntax to me...

Share this post


Link to post
Share on other sites
[code]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";
}}}}}
}[/code]

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):

[code]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";
  }
}[/code]

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.