Forum Moderators: open

Message Too Old, No Replies

Auto refresh

i need ideas to formulate

         

nanat

9:06 am on Sep 2, 2009 (gmt 0)

10+ Year Member



i trying to create select statement once the user select an items it will automatically change fields on the same page..

ex.
default: select 1
fruits > orange, apple, banana
======================
on select 2 automatic reload
trees > Pine, nara, Evergreen


<select name="Group">
<option value="<?=$Vid?>"><?=$Vname?></option>
<?php
$result = mssql_query("select * from HBIGroups");
$exist = mssql_num_rows($result);

if($exist > 0)
{
for($i=0; $i < $exist; $i++)
{
$Vid = mssql_result($result, $i, "GroupID");
$Vnamae = mssql_result($result, $i, "GroupName");

echo "

<option value=".$Vid.">".$Vnamae."</option>
";
}

}
else
{

echo '<script type="text/javascript">
alert("Unable to set a session! Please try again...");
history.go(-1);
</script>';

}
?>
</select>

whoisgregg

7:08 pm on Sep 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What does your generated code look like? In this example, the PHP code will generate the <options>, but nothing is automatically updated.

nanat

12:42 am on Sep 3, 2009 (gmt 0)

10+ Year Member



no.. i know its impossible in php to make an auto reload by just select option.. how about in javascipt, ajax or jquery?

actually aim trying to combine php and those languages.. but i dont have any idea to start with.. can u give me some simple idea how to start with?

tnx..

whoisgregg

2:57 pm on Sep 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would try looking for one of the existing tutorials on the subject. I believe a search in your favorite search engine for something like "ajax multiple select" or "ajax dynamic drop down" should yield many different starting points.

Of course, if you run into trouble implementing these, please post back with relevant code snippets and we'll do our best to help. :)

nanat

8:40 am on Sep 8, 2009 (gmt 0)

10+ Year Member



Gregg I have Question if u dont mind ^^ this my code

var message = new Array();
message[1] = "1";
message[2] = "2";
message[3] = "3";
message[4] = "4";
message[5] = "5";
message[6] = "6";

$(document).ready(function(){
$("#item_select").change(function()
{
var message_index

message_index = $("#item_select").val();
if (message_index > 0)
$("#message_display").html("<input type=""value="message_index" name="message_index" / >");
});
});

my question is what is the ryt syntax of getting the value from jquery to php


<input type=""value="message_index" name="message_index" / >

$Group=@$_GET["message_index"];