johnwhello Posted October 13, 2006 Share Posted October 13, 2006 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 https://forums.phpfreaks.com/topic/23902-if-statement-doesnt-work/ Share on other sites More sharing options...
zq29 Posted October 13, 2006 Share Posted October 13, 2006 Are you sure that this is PHP related? Looks more like JavaScript syntax to me... Link to comment https://forums.phpfreaks.com/topic/23902-if-statement-doesnt-work/#findComment-108630 Share on other sites More sharing options...
kanikilu Posted October 13, 2006 Share Posted October 13, 2006 [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 https://forums.phpfreaks.com/topic/23902-if-statement-doesnt-work/#findComment-108636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.