Jump to content

drop down box execution


truegilly

Recommended Posts

Hi People  ;)

 

ive seen this on many e-commerce website and im sure you have too.

 

lets say you have a HTML drop down box and when a user selects a particular value something happens at runtime, like the page refreshes or some area of the page is altered.

 

A good example was on a UK train company website i used to buy tickets from. When you select "railcard" from the drop down box the form adjusts to fit that selection without the browser redirecting to another URL.

 

heres my simple box HTML code....

 

          <select name="type">
            <option>Please Select</option>
            <option value="Risk">Risk</option>
            <option value="Issue">Issue</option>
          </select>

 

what i would love to be able to do is if a user selects "Issue" one of the form fields within the same page is removed.

 

i was thinking about attempting this with the PHP code below...

 

if ($_POST['type'] = 'Issue' {

do something to the form

}
else {

dont cahnge anything !

}

 

the thing that is puzzling me is how this can be done at runtime.

 

Is this at all possible in PHP ?? or is it a javascript thing.  ???

 

Thank you for any help

 

Truegilly  :-*

Link to comment
https://forums.phpfreaks.com/topic/37657-drop-down-box-execution/
Share on other sites

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.