Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Char

'type' Not Passing From Url To Page - Type Undefined

Recommended Posts

Hello, I'm going through the book, but decided to get cute and try multiple links instead of goodies and coffee...now i'm not at all impressed with that decision, cuteness is overrated.

 

I've created the links:

<li class="topmenu"><a href="/hciShop/Wigs.php" ">Farley Wig Super Collection</a></li>
    <li class="topmenu"><a href="/hciShop/IndianEX.php">Indian Wefts</a></li>
        <li class="topmenu"><a href="/hciShop/BrazillianEX.php">Brazillian Wefts</a></li>
        <li class="topmenu"><a href="/hciShop/VirginFU.php">Indian Fusions </a></li>
          <li class="topmenu"><a href="/hciShop/ClipOn.php""><span>Virgin Indian Clip-on Extensions</span></a></li>
    <li class="topmenu"><a href="/hciShop/TopClosures.php""><span>Closure top hair pieces<span></a></li>
    <li class="toplast"><a href="hciShop/Accessories.php">Accessories</a></li>

 

and I've modified my .htaccess:

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine on

# For the primary categories:
RewriteRule ^hciShop/(Wigs|BrazillianEX|IndianEX|IndianFU|BrazillianFU|RemyFU|Accessories|TopClosures|ClipOn)/?$ hciShop.php?type=$1

# For specific products:
RewriteRule ^hciBrowse/(Wigs|BrazillianEX|IndianEX|IndianFU|BrazillianFU|RemyFU|Accessories|TopClosures|ClipOn)/([A-Za-z\+\-]+)/([0-9]+)/?$ hciBrowse.php?type=$1&category=$2&id=$3

 

 

I then wrote my validation in hciShop.php:

if (isset($_GET['type']) && ($_GET['type'] === 'Wigs')){
                $page_title = 'HCI Human Hair Wigs Super Collection by Category';
                $type ='Wigs';
            } elseif (isset($_GET['type']) && ($_GET['type'] === 'BrazillianEX')){
                $page_title = 'HCI Human Hair Brazillian Weft Extensions by Category';
                $type ='BrazillianEX';
            } elseif (isset($_GET['type']) && ($_GET['type'] === 'IndianEX')){
                $page_title = 'HCI Human Hair Indian Weft Extensions by Category';
                $type ='IndianEX';
            } elseif (isset($_GET['type']) && ($_GET['type'] === 'IndianFU')){
                $page_title = 'HCI Human Hair Indian Fusion Extensions by Category';
                $type ='IndianFU';
            } elseif (isset($_GET['type']) && ($_GET['type'] === 'TopClosures')){
                $page_title = 'HCI Human Hair Closure Top Pieces by Category';
                $type ='TopClosures';
            } elseif (isset($_GET['type']) && ($_GET['type'] === 'ClipOn')){
                $page_title = 'HCI Human Hair Clip-On Extensions by Category';
                $type ='ClipOn';
            } else if (isset($_GET['type']) && ($_GET['type'] === 'Accessories')){
                $page_title = 'HCI Accessories by Category';
                $type ='Accessories';
            }

 

Everything is in the db but not seperated out into seperate tables for each type, but I did give each category it's own id so my mySql prepared statement looks like this:

 

if ($type =='Wigs') {
            $r = mysqli_query($dbc, 'SELECT * FROM productCategories WHERE productCategories.genCatId = 101 ORDER by Name');
            
             } elseif ($type == 'BrazillianEX') {
            $r = mysqli_query($dbc, 'SELECT * FROM productCategories WHERE productCategories.genCatId = 105 ORDER by prodName');
            
             } elseif ($type == 'IndianEX') {
            $r = mysqli_query($dbc, 'SELECT * FROM productCategories WHERE productCategories.genCatId = 106 ORDER by prodName');
            
             } elseif ($type == 'IndianFU') {
            $r = mysqli_query($dbc, 'SELECT * FROM productCategories WHERE productCategories.genCatId = 103 ORDER by prodName');
            
             } elseif ($type == 'Accessories') {
            $r = mysqli_query($dbc, 'SELECT * FROM productCategories WHERE productCategories.genCatId = 109 ORDER by prodName');
            
             } elseif ($type == 'TopClosures') {
            $r = mysqli_query($dbc, 'SELECT * FROM productCategories WHERE productCategories.genCatId = 107 ORDER by prodName');
            
             } elseif ($type == 'ClipOn') {
            $r = mysqli_query($dbc, 'SELECT * FROM productCategories WHERE productCategories.genCatId = 108 ORDER by prodName');
             }

           

...and I get an error that says that type is undeclared...

I've checked my permissions and all good, i've tried the statement and it returns the rows of info...it's just not going from browser to page.

 

I've obviously done something wrong or it would work. Another set of eyes and a pointer in the right direction will help. Thanks in advanced for any help you can render!

 

Share this post


Link to post
Share on other sites

Your .htaccess is probably failing. I'd start by confirming that .htaccess is working in general. Then confirm whether you're receiving any type value at all.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...