Refreshing page after select from Drop Down list

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
AaaDee
New php-forum User
New php-forum User
Posts: 25
Joined: Mon Jun 24, 2002 1:10 am
Location: Huddersfield
Contact:

Refreshing page after select from Drop Down list

Postby AaaDee » Mon Jul 15, 2002 1:28 am

Hi, i have an employee profile page so it updates a persons details after a user fills in their details.

i want to make it so i have a drop down list (linked to DB) and when i select name = Adam Bell it will refrsh the page and pull out all details for Adam Bell from the employee database.

i have got the drop down list, how can i make it refresh and add all the details in a text area for their details.

Cheers

elitecodex
New php-forum User
New php-forum User
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA
Contact:

Postby elitecodex » Mon Jul 15, 2002 3:17 am

This would actually have to be done with JavaScript (which is different on each browser until all browsers adopt a standard). The two biggest ones in the windows world are MSIE and Netscape (obviously) and I think it is similar. Just have something like:

Code: Select all

<select name="emp_drop_down" onSelect="location.href='view_details.php?id=' + document.formNameHere.emp_drop_down.selectedItem;">

  <option value="1">Whoever</option>
  <option value="2">Next name</option>
  <option value="3">And so on...</option>

</select>


Im not sure if that syntax is 100% right, but that will redirect the user when they select a name in the box to "view_details.php" with the ID in the query string. And have the view_details.php file load the information from the database. Like I said, this is JavaScript, which I dont do much with. Its either onChange or onSelect, but I cant remember which one exactly. Maybe another person here will know the exact syntax, but that is about how it goes. Best of luck!

Will

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Refreshing page after select from Drop Down list

Postby WiZARD » Mon Jul 15, 2002 4:43 am

AaaDee wrote:Hi, i have an employee profile page so it updates a persons details after a user fills in their details.

i want to make it so i have a drop down list (linked to DB) and when i select name = Adam Bell it will refrsh the page and pull out all details for Adam Bell from the employee database.

i have got the drop down list, how can i make it refresh and add all the details in a text area for their details.

Cheers


Hi Adam!

This is ansver at your question and this script working:

Code: Select all

<FORM name=ShortcutMenu action="javascript:gotosite()" onSubmit="return chkCtry(SelectCountry);" method=post>
   
     <SELECT onchange=takeShortcut() name=SelectCountry> <OPTION value="title"
        selected>Select a country site</OPTION> <OPTION
              value=------------------>------------------</OPTION><OPTION
              value="asean">ASEAN</OPTION><OPTION
              value="anz">Australia</OPTION><OPTION
              value="india">Bangladesh</OPTION><OPTION
              value="china">China</OPTION><OPTION
              value="china">Hong Kong</OPTION><OPTION
              value="india">India</OPTION><OPTION
              value="asean">Indonesia</OPTION><OPTION
              value="japan">Japan</OPTION><OPTION
              value="korea">Korea</OPTION><OPTION
              value="asean">Malaysia</OPTION><OPTION
              value="india">Nepal</OPTION><OPTION
              value="anz">New Zealand</OPTION><OPTION
              value="india">Pakistan</OPTION><OPTION
              value="asean">Phillipines</OPTION><OPTION
              value="asean">Singapore</OPTION><OPTION
              value="india">Sri Lanka</OPTION><OPTION
              value="taiwan">Taiwan</OPTION><OPTION
              value="asean">Thailand</OPTION><OPTION
              value="asean">Vietnam</OPTION><OPTION
      </SELECT>


This code i'm get from http://www.Seagate.COM
All copyright is ok! :D
See ya!


Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

cron