Jump to content

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

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.