Jump to content

if path equals help


xstevex

Recommended Posts

Hi,

 

I'm trying to get this statement to work:

 

<?php  if ($path = 'http://www.mysite/directory1/') { ?> <!--nothing--> <?php }

else { ?> <?php print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; ?> <?php } ?>

 

The problem I think is with the $path bit. I want the second bit to show up on every page except the $path pages.

 

I've tried $url and others but haven't found the right way to do it. My php knowledge is very basic.

 

Thanks,

Steve.

Link to comment
https://forums.phpfreaks.com/topic/83677-if-path-equals-help/
Share on other sites

Ok, I'm sorry.

 

Essentially all I'm trying to do is make a statement that does: if it is in URLx, the thing doesn't show, but if it is in any other URL, the thing does show.

 

I've just learnt how to define variables now so I can define a variable if needed.

 

Or, "if not in URLx, show the thing" would be good too.

Link to comment
https://forums.phpfreaks.com/topic/83677-if-path-equals-help/#findComment-425738
Share on other sites

just nocked this up try it quite good lol....

 

i wrote this so you get the jeft ok mate.....

 

type anythink what in the array get a result...........

 

<?php

$x=array('http://www.google.com','http://www.msn.com','http://www.yahho.com');

if($_POST['submit']){

	$url=$_POST['url'];

	if(in_array("$url",$x)){

		echo " congratulations goto <a href='$url'>>>here<<<a/>";
		exit;
	}else{
	echo "sorry we have no $url of this type please try agin <a href='".$_SERVER['PHP_SELF']."'>>>here<<<a/>";
	exit;
	}
     }
          
echo"<center>
<form method='POST' action=' '>
<br><br>
please provide your url <br>
The name off the website<br>
example http://www.google.com!
<br><br>
<input type='text' name='url'>
<br><br>
<input type='submit' name='submit' vlaue='Send'>
</form> 
</center>";

?>

Link to comment
https://forums.phpfreaks.com/topic/83677-if-path-equals-help/#findComment-425755
Share on other sites

Archived

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

×
×
  • 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.