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
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.

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.