dynamicly linked dropdown lists

Reply

Join Date: Oct 2008
Posts: 61
Reputation: Manuz is an unknown quantity at this point 
Solved Threads: 8
Manuz's Avatar
Manuz Manuz is offline Offline
Junior Poster in Training

Re: dynamicly linked dropdown lists

 
0
  #21
Oct 23rd, 2008
Use Ajax 4 best perfomance
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 54
Reputation: HazardTW is an unknown quantity at this point 
Solved Threads: 2
HazardTW HazardTW is offline Offline
Junior Poster in Training

Re: dynamicly linked dropdown lists

 
0
  #22
Oct 23rd, 2008
The solution I sent him does
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 42
Reputation: marcmm is an unknown quantity at this point 
Solved Threads: 0
marcmm marcmm is offline Offline
Light Poster

Re: dynamicly linked dropdown lists

 
0
  #23
Nov 14th, 2008
guys, sorry for beying so silent over the past weeks, been flooded with other things that I didn't have time to look over that suggestion properly, but I will be looking voer ti soon and will provide feedback about weather I could or couldn't fix the problem

Please bear with me.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 42
Reputation: marcmm is an unknown quantity at this point 
Solved Threads: 0
marcmm marcmm is offline Offline
Light Poster

Re: dynamicly linked dropdown lists

 
0
  #24
Dec 9th, 2008
Ok guys... I took the time to look over the posted solution... but I'm affraid I was not able to understand half of what was going on in there.

I fiddled around and came up with this simplistic example:

  1. <html>
  2. <head>
  3. <title>Exemplu select</title>
  4. <script language="javascript">
  5.  
  6. function onchangeCounty()
  7. {
  8. document.form1.submit();
  9. }
  10. </script>
  11. </head>
  12. <body>
  13.  
  14. <?php
  15. $County1 = $_GET[County];
  16. ?>
  17.  
  18. <form name="form1" METHOD=get >
  19.  
  20. County:
  21. <select name="County" onchange="onchangeCounty();">
  22. <option value=""></option>
  23. <option value="name1">Name1</option>
  24. <option value="Name2">Name2</option>
  25. </select>
  26.  
  27. <?php
  28.  
  29. $con = mysql_connect("localhost","root","");
  30. if (!$con)
  31. {
  32. die('Could not connect: ' . mysql_error());
  33. }
  34. mysql_select_db("DBname", $con);
  35. $select="SELECT * FROM tablename WHERE Countyname='$County1'";
  36. echo "<br>";
  37. $result = mysql_query($select);
  38. echo "County:";
  39. echo "<select>";
  40. while($row = mysql_fetch_array($result))
  41. {
  42. echo "<option>" . $row['Countyname'] . "</option>";
  43. }
  44. echo "</select";
  45. mysql_close($con);
  46. ?>
  47. </form>
  48. </body>
  49. </html>

Now this works preatty well as it is... but it needs enhancing.

First of all, the option selected in the first list dosen't stay selected when the form reloads. I am transmitting the value and it's there when the form reloads via the get methode... but I haven't the slightest clue how to force the select object to target it after it has been repopulated. Any ideas?

Secondly. this example has the form only containing the dropdown lists. but I intend to use it in a form that will contain checkboxes too. well I don't want to loose the selected checkboxes when the form reloads... so is there a way in wich to put one form inside another?

Like:

<form1>
<form2>
code for dropdown lists and dropdown lists set with the onchange reload option
</form2>
code for checkboxes and submit button
</form1>

Or do I have to go and get all the values of any selected checkbox and send it through the link back to the beginning of the form and then re-select them?

and if so, the same question from the dropdown lists applies here... how do you force these objects to have a particular option set based on what data is beying transmited?

I would apreciate any feedback on this.

( Oh yes, and as a sidenote, it was pointed to me that the "joomla" is a stable and efficient designing enviroment for web based aplications. would it be advisable to use such an enviroment over notepad coding and development? )
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 42
Reputation: marcmm is an unknown quantity at this point 
Solved Threads: 0
marcmm marcmm is offline Offline
Light Poster

Re: dynamicly linked dropdown lists

 
0
  #25
Dec 10th, 2008
the database is called DBname. it contains just one table called tablename.

the table contains just two columns. a county column and a cityname column.

I would really apreciate some feedback on this guys. Please...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC