Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Problem with ajax call

1:58 pm on Aug 3, 2011 (gmt 0)

New User

joined:Aug 3, 2011
votes: 0

Guys plz need a help.

index page

<form id="form1" name="form1" method="get" action="show.php">
<select name="cg" onchange="SearchC();" id="catG" >
<option value="1" >&#1042;&#1057;&#1045; &#1050;&#1040;&#1058;&#1045;&#1043;&#1054;&#1056;&#1048;&#1048;</option>
<option value="2"<? if($pcat=="2")echo "selected='selected'"; ?>>subject</option>
<option value="3" <? if($pcat=="3")echo "selected='selected'"; ?>>faculty</option>
<option value="4" <? if($pcat=="3")echo "selected='selected'"; ?>>lecture</option>


function SearchC() {
var category = $("#catG").val();
var query = "searchbox.php?ct="+category;
url: query,
success: function(data, textStatus, XMLHttpRequest) {

and searchbox.php

if (($_GET['ct'] == '1'))

<select name="subj" id="subj" class="textbox">
<option value="1"> math </option>
<option value="2"<? if WHAT TO WRITE HERE echo "selected='selected'";?>>phys</option>
} ?>

then Im moving to show.php i need to show appropriate "cg" and "subj" which I selected in index.php.

value for "cg" m passing like -> if (isset($_GET['cg'])){$pcat=$_GET['cg'];}

How to pass and make selected "subj" value in show.php?