Jump to content

If statements issue ...


bsamson

Recommended Posts

Alright ... I thought I had a basic understanding of if statements ... but my current project has proved that wrong ...

Let's say that I am calling this page:
  index.php

After I am calling another page via:
  index.php?p=contact

Now, I have this code:

[code]<?php
  // Get page
  $rpage = $_GET[p];

  // Set Default page & title if p is empty
  if (empty($rpage)) {
  $page ="index_inc.php";
  $title="NY Mobile LLC&nbsp; -&nbsp; Internal Network";
  }

  if ($rpage="contact") {
  $page ="contact_inc.php";
  $title="NY Mobile LLC&nbsp; -&nbsp; Internal Network&nbsp; -&nbsp; Contact Information";
  }
?>[/code]

  When I run this page it displays the contact page ... But $rpage is empty! Any help would be appreciated! Thanks!

[b]EDIT By thorpe: Please use the full <?php tags with our [ code ] tags, it adds the benifit of syntax highlighting. You should really be using them in your code anyway.
Link to comment
https://forums.phpfreaks.com/topic/27643-if-statements-issue/
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.