#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7

    Overlooking something in if/else statement?


    Howdy. I did the main page just fine, and am now adding in an if/else to show a view/edit box if item is clicked. When clicking the "Add New" button, the module portion of the page becomes blank. I figured maybe I did the include wrong, even though it's the same as the working included functions.php. I tossed in an echo just for the sake of a response, but no luck. Any ideas what I'm overlooking here? Thanks for any help.

    PHP Code:
                          <?php
                            
    include('modules/rolodex/functions.php');
                            if(isset(
    $_GET['action']) && ($_GET['action'] == "add" || $_GET['action'] == "edit" || $_GET['action'] == "view")) {
                              echo 
    "Hi.";
                              include(
    'modules/rolodex/profile.php');
                            } else { 
    ?>
                          <TABLE id="heading">
                            <TR id="function">
                              <TD align="left"><INPUT type="button" value=" Add New " onClick="parent.location='?loc=rolodox&action=add'" /></TD>
                              <TD align="center">Search: <INPUT type="text" id="search" placeholder="Type to search" /></TD>
                              <TD align="right"><INPUT type="button" value=" Close " onClick="parent.location='?loc=main'" /></TD>
                            </TR>
                          </TABLE>
                          <DIV id="outer">
                          <DIV id="innera" style="border-bottom: 1px solid black;border-left: 1px solid black;border-right: 1px solid black;">
                            <script src="modules/rolodex/sorttable.js"></script>
                            <TABLE id="table" class="sortable">
                              <colgroup>
                                <col width="290">
                                <col width="160">
                                <col width="110">
                                <col width="170">
                                <col width="90">
                                <col width="250">
                                <col width="100">
                              </colgroup>
                              <THEAD>
                                <TR>
                                  <TH width="287">Company</TH>
                                  <TH width="157">Name</TH>
                                  <TH width="107">Position</TH>
                                  <TH width="167">Number</TH>
                                  <TH width="87">Type</TH>
                                  <TH width="247">E-Mail</TH>
                                  <TH width="115" style="border-right: 1px solid black;">Notes</TH>
                                </TR>
                              </THEAD>
                              <TBODY>
    <?php buildListing(); ?>
                              </TBODY>
                            </TABLE>
                          </DIV>
                          </DIV>
                          <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
                          <script>
                            var $rows = $('#table tbody tr');
                            $('#search').keyup(function() {
                              var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
                              $rows.show().filter(function() {
                                var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
                                return !~text.indexOf(val);
                              }).hide();
                            });
                          </script>
                          <?php ?>
  2. #2
  3. For POny!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    Amsterdam
    Posts
    416
    Rep Power
    115
    HI i just tried,

    If I press "add" I get your echo "hi!"
    don't you get an error, like failed to open stream
    for
    Code:
    include('modules/rolodex/profile.php');
    If you didn't already you might want to place this above your script:
    PHP Code:
    ini_set('display_errors',1); 
     
    error_reporting(E_ALL); 
    Last edited by aeternus; February 14th, 2013 at 10:03 AM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    I am running this server development to difine anything and everything. At least you're getting the 'Hi.". I wonder why I am not.

    Wow. I moved the echo to even before the include() for the sake of it, and still no output. wtf... This whole page worked PERFECT unitl I simply added the if/else. But even an echo before any of the module items won't echo. :-/
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Well, this is odd. I removed the added items, and the main page DOES work fine, but the catch/issue seems to be the added &action=add which gets added to the address. loc=rolodex is still there to stay within the same module, but why would the action=add messt hings up? It's only reference is the if/then n it blanks even w/o that. Any ideas? :-/
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Ok. Please tell me this should NOT matter....


    Works as desired: http://address/?action=add&loc=rolodex
    Does NOT work: http://address/?loc=rolodex&action=add
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Wow. Gotta love how the SIMPLEST of mistakes make for the hugest issues... ^_^

    Simple mispelling of rolodex as rolodox.
  12. #7
  13. For POny!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    Amsterdam
    Posts
    416
    Rep Power
    115
    I am certain that if you placed that snippet (error reporting part) above your code this would have been reported
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    677
    Rep Power
    7
    Bleh. I guess dis dudes server isn't set up as I thought. Should've been a file not found for an include. :-/

IMN logo majestic logo threadwatch logo seochat tools logo