954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Use Ajax 4 best perfomance

Manuz
Junior Poster
122 posts since Oct 2008
Reputation Points: 12
Solved Threads: 24
 

The solution I sent him does :)

HazardTW
Junior Poster in Training
71 posts since Sep 2007
Reputation Points: 37
Solved Threads: 3
 

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.

marcmm
Light Poster
42 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

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:

<html>
<head>
	<title>Exemplu select</title>
<script language="javascript">

function onchangeCounty()
{
	document.form1.submit();
}
</script>
</head>
<body>

<?php
	$County1 = $_GET[County];
?>

<form name="form1" METHOD=get >

	County:
	<select name="County" onchange="onchangeCounty();">
		<option value=""></option>
		<option value="name1">Name1</option>
		<option value="Name2">Name2</option>
	</select>

	<?php

	$con = mysql_connect("localhost","root","");
	if (!$con)
	{
	    die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("DBname", $con);
	$select="SELECT * FROM tablename WHERE Countyname='$County1'";
	echo "";
	$result = mysql_query($select);
	echo "County:";
	echo "<select>";
	while($row = mysql_fetch_array($result))
	{
		echo "<option>" . $row['Countyname'] . "</option>";
	}
	echo "</select";
	mysql_close($con);
	?>
</form>
</body>
</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:


code for dropdown lists and dropdown lists set with the onchange reload option

code for checkboxes and submit button

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? )

marcmm
Light Poster
42 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

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...

marcmm
Light Poster
42 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You