943,778 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3396
  • PHP RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Oct 23rd, 2008
0

Re: dynamicly linked dropdown lists

Use Ajax 4 best perfomance
Reputation Points: 12
Solved Threads: 24
Junior Poster
Manuz is offline Offline
122 posts
since Oct 2008
Oct 23rd, 2008
0

Re: dynamicly linked dropdown lists

The solution I sent him does
Reputation Points: 37
Solved Threads: 3
Junior Poster in Training
HazardTW is offline Offline
71 posts
since Sep 2007
Nov 14th, 2008
0

Re: dynamicly linked dropdown lists

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.
Reputation Points: 10
Solved Threads: 0
Light Poster
marcmm is offline Offline
42 posts
since Oct 2008
Dec 9th, 2008
0

Re: dynamicly linked dropdown lists

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:

PHP Syntax (Toggle Plain Text)
  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? )
Reputation Points: 10
Solved Threads: 0
Light Poster
marcmm is offline Offline
42 posts
since Oct 2008
Dec 10th, 2008
0

Re: dynamicly linked dropdown lists

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...
Reputation Points: 10
Solved Threads: 0
Light Poster
marcmm is offline Offline
42 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: rtf file convert to text format using php
Next Thread in PHP Forum Timeline: logout.php





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC