Jump to content

[SOLVED] Link to certain select box option?


JJenson

Recommended Posts

Ok this is what I have and I can't figure out how to do this exactly.

 

I have 2 links on one page going to the same page which is a contact us page.

 

There is 4 options at the top of the page for the type of request the customer is making. If they click one link I want that to be selected in the box but if they select the other link I want it to be in the format its in now this is the code I have:

 

These are my links I put in the ?commercial thinking of passing that value for the select box.

<td align="center" bgcolor="#CCCCCC"><img src="images/spacer.gif" width="1" height="10" alt="" /><br />
<a href="javascript:popUp('contactPop.php?commercial')" class="rightBoxNavOff" onmouseover="this.className='rightBoxNavOn'" onmouseout="this.className='rightBoxNavOff'">Commercial Services</a><br />
   <a href="javascript:popUp('contactPop.php')" class="rightBoxNavOff" onmouseover="this.className='rightBoxNavOn'" onmouseout="this.className='rightBoxNavOff'">Request a FREE<br />
   no-obligation inspection</a></td>

 

This is my select box I am unsure how I would go about writing this in PHP I have been predonminantly a .asp programmer.

 

<select name="Contact" id="Contact">
    <option value="Allergen/Mite Test">Allergen/Mite Test</option>
    <option value="Fire Inspection or Demo">Fire Inspection or Demo</option>
    <option value="Stain Inspection or Demo">Stain Inspection or Demo</option>
    <option value="Commercial Application">Commercial Application</option>
</select>

 

If the first link above is selected I want the commercial applications to show as selected if the second link is click I want it to show in this order.

 

Thanks All  :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/87409-solved-link-to-certain-select-box-option/
Share on other sites

Ok I figured it out This is the code I used:

 

contactPop.php?idname=commercial    -    This is for the link

 

<option value="Commercial Application" <?php $idname=$_GET["idname"]; if ($idname == "commercial"){echo "selected";}?>>Commercial Application</option>  -  For the option to make it selected if the link above is clicked.

 

 

 

 

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.