Jump to content

if/ statement doesn't work


johnwhello

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!
Link to comment
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 ;)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.