PDA

View Full Version : invisible menu item unless item in DB


bufhal
05-10-2006, 02:27 PM
Hello;
I am stuck and hope someone can help me.
I have a menu attached to a MySQL DB that has various items stored and are called with PHP when a user clicks on the link.
(I included the menu code below and bolded the code to call the field in the DB which I have entered some info)
I want to add a menu item that is only visible if there is something stored in the DB but it is not working.

I appreciate any help. Thank you in advance.


<table cellspacing="0" cellpadding="0" id="menu2" class="ddmx">
<tr>
<td>
<td bordercolor="#000000">
<a class="item3 arrow" href="javascript:void(0)">Product Information<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>

<div style="border: 2px; #FFFFFF" class="section">

<a class="item2" href="<?php echo $tech_url; ?>"> Tech Sheet - <?php echo $techsheet; ?> </a>
<a class="item2" href="<?php echo $broch_url; ?>"> Product Brochure - <?php echo $brochure; ?> </a>
<a class="item2" href="/howtobuy.html">How to Buy</a>
</div>

<a class="item3 arrow" href="javascript:void(0)">Drivers & Downloads<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="<?php echo $soft_url; ?>">Software - <?php echo $soft; ?></a>

<a class="item2" href="/products.html">Product Information</a>
</div>

<a class="item3 arrow" href="javascript:void(0)">Manuals & Specifications<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="<?php echo $manual_url; ?>"> Manual - <?php echo $manual; ?> </a>
<a class="item2" href="/trouble.html">FAQs</a>
</div>
<a class="item3 arrow" href="">Certifications<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>

<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="/certs.html">Partner Certifications</a>
</div>

<a class="item3 arrow" href="javascript:void(0)">Support & Service<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="/techsupt.html">Contact Tech Support</a>
<a class="item2" href="/trouble.html">Troubleshooting Tips & FAQs</a>
<a class="item2" href="/warrantyinfo.html">Warranty Information</a>
<a class="item2" href="/license.php">Authorize Products</a>
<a class="item2" href="/registration.php">Register Products</a>
<a class="item2" href="/services/index.html">Service Programs</a>
</div>

<a class="item3 arrow" href="javascript:void(0)">Request Information<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="/oem.html">Request Sales Support</a>
<a class="item2" href="/techsupt.html">Request Technical Support</a>
<a class="item2" href="/techsupt.html">Request Technical Support</a>

<a class="item2" href="/techsupt.html">Request Technical Support</a>

</div>
<a class="item3 arrow" href="javascript:void(0)">Solutions<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="/oemsolutions.html">OEM</a>
<a class="item2" href="/digitalcc.html">Digital Content Creation</a>
<a class="item2" href="/business.html">Backup</a>
</div>
<?php
if ($db_field == 'url15') {
?>
<a class="item2" href="<?php echo $url15; ?>"> Special <?php echo $url15; ?> </a>
<?php
}
?>



</td>
</tr>
</table><!-- #EndLibraryItem -->
</td>
</tr>
</table>

Fumigator
05-10-2006, 06:40 PM
You didn't show us the PHP side of things... have you tried displaying what is in the $db_field variable?

bufhal
05-12-2006, 02:07 PM
Thanks Fumigator;
The PHP is in the menu only in the spots that have entries in the database:
e.g. <a class="item2" href="<?php echo $tech_url; ?>"> Tech Sheet - <?php echo $techsheet; ?> </a>

I have two fields in MYSQL:
url15_url(URL) url15(description) both set to NULL-no and default-blank
(I am using PHP MYSQL and I left nothing in the default)

Here is the test link:
http://www.attotech.com/gary_side_test.html

Below is the bottom section of the menu with bolded area where I am having issues. I need the "Special" to only appear when there is something in the Database fields url15 and url15_url


<a class="item3 arrow" href="javascript:void(0)">Request Information<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="/oem.html">Request Sales Support</a>
<a class="item2" href="/techsupt.html">Request Technical Support</a>
</div>
<a class="item3 arrow" href="javascript:void(0)">Solutions<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class="item2" href="/oemsolutions.html">OEM</a>
<a class="item2" href="/digitalcc.html">Digital Content Creation</a>
<a class="item2" href="/business.html">Backup</a>
</div>

<a class="item3 arrow" href="javascript:void(0)">Special<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<?php
if (isset($url15) and $url15 != "") {
// Check that there is an entry in the database
// if the url15 field is set to NOT NULL and DEFAULTs to ""
// you can use if ($url15 !="") {
echo "<a class="/item2/" href="/$url15_url/">Special: $url15</a>";
}
?> </div>
</td>
</tr>
</table><!-- #EndLibraryItem -->

Thank you for your time--If there is something you don't understand, please let me know...

bufhal
05-15-2006, 06:00 PM
Thanks for your reply. I have the field "Special" in the side menu:
http://www.attotech.com/gary_side_test.html
and it is displaying what is in the DB properly, however, the field "Special" still appears when there is nothing in the DB fields: url15 and url15_url.
It should not appear when those two fields are empty. I tried changing my settings in PHP MYADMIN, but no luck.

This is what is happening:
source code live on server
<a class="item3 arrow" href="javascript:void(0)">Special<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<a class='item2' href='software/files/manuals/Celerity.pdf?PHPSESSID=c6f8f3c88984a195415aa726a59d17c7'>Hello World</a>
</div>
source code
<a class="item3 arrow" href="javascript:void(0)">Special<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
<div style="border: 2px; #FFFFFF" class="section">
<?php
if ($url15 != "blank") { echo "<a class='item2' href='$url15_url'>$url15</a>"; }
?>
</div>
Can you please show me how to get the code show the "special" link when the field is populated?
Thank you very much for any help.