Jump to content

Recommended Posts

I have a page that makes a list based on all open tickets. I'd like to have a dropdown on that page that users can make a selection and then the page refreshes with either just their open tickets, are all their closed tickets or both.

 

I can figure out all the different db select statements to display the different data, but I'm confused on how to run the dropdown box. I'd like to stick with PHP and not do any javascript.

 

Can anyone point me towards a tutorial or make suggestion, like: use switch statements or if/else.

 

Can I do something like this in PHP

<form action="" method="post" name="pageView" >

 

<select name="viewList" onchange="OnChange(this.form.viewList);">

 

and have this call a function

 

Signed,

Confused

you'd need to use javascript.. but include a button somewhere under or to th eside of the button incase a user has disabled JavaScript..

 

but you'd do something like this:

 

<script type="text/javascript">
  function _switch(obj) {
    //either submit the form (which you could do from onChange .submit()
    // or set the new url manually..
    top.location = "http://new.url.com/?whatever="+obj.value;
  }
</script>
<select name="whatever" onChange="_switch(this)">
  <option value="1">Whatever</option>
</select>

Based on which selection is made, a new call to the database will need to be made. Can that be done from within a javascript switch statement.

 

does PHP have an onchange or should I call a class file each time and the db call made is based on the value of the dropdown? Can the page then update itself?

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.