Jump to content

[SOLVED] $page == "update" or "new" HELP???


Presto-X

Recommended Posts

How would I do this, I'm trying to use if something or something do the same thing with out having to put all the same code in twice.

 

if ( $page == "update" or "new" ){echo "Saving...";}

 

I have been fooling around with this for a day and it is driving me nuts I did not know what to search for I was not coming up with anything of any use. I tride:

 

$page == "update","new"
$page == "update" or "new"
$page == 'update' or 'new'

Link to comment
Share on other sites

Thank you guys so much it looks like it is working great now, I'm going back cleaning out alot of the if and elses in there lol thanks guys.

 

Hay Caesar what do you mean by "register_globals will be set" ? I'm new to php and I'm still learning all of the terms.

Link to comment
Share on other sites

If you're sending values using urls such as:

 

http://somesite.com/index.php?page=pr0n

 

Then you want to make sure that you retrieve the values by using $_GET, instead of writing your code to look for $page. When you do that, you're asuming the server the site is on, has register_globals set to "on". And once you move your script somewhere else, it's likely it will stop working.

 

So your code should look something like:

 

<?php

  $page = $_GET['page'];

  if (($page == 'pr0n') | ($page == 'nekkid')) {

  echo'You dirty dirty boy...*snicker*';

  }

?>

 

Good luck and happy coding!

 

 

 

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.