but when ever I try to submit the form I've perviously recived it doesnt get the
dropdown list value...
why can't I get the dropdown list value?
this is what im doing when im trying to "catch" the POST:
PHP Code:
if (isset($_POST['cat'.$arr['id']]))
{
$cat = secure($_POST['cat'.$arr['id']]);
if ($cat !== "")
mysql_query("INSERT INTO jobinfo (user_id,content, cat_id, catlist_id) VALUES ('".$uid."','','".$arr['id']."','".$cat."')");
}
this is my code on the main PHP file:
PHP Code:
echo '<div id="result'.$arr['id'].'">';
echo '<select name="cat'.$arr['id'].'" id = "cat'.$arr['id'].'" style="width:180px;">';
echo '<option value="">- '.$arr['category'].' -</option>';
$select_cat = mysql_query("SELECT * FROM searchcatslist WHERE cat_id='".$arr['id']."'");
while ( $arr_cat = mysql_fetch_array($select_cat) )
{
echo '<option value="'.$arr_cat['id'].'">'.$arr_cat['category'].'</option>';
}
echo '</select>';
echo '</div>';
if ($arr['sortby'] > 0)
{
echo '<script>
$("#cat'.$arr['sortby'].'").live("click", function(event){
$("#cat'.$arr['sortby'].'").change(function () {
var values = $("#cat'.$arr['sortby'].'").val();
';
echo '$.post("ajax_dlists.php", { id: values, count: "'.$arr['tafpos'].'", multiple: "not" },';
echo 'function(data){
$("#result'.$arr['id'].'").empty();
$( "#result'.$arr['id'].'" ).html(data);
});
});
});
</script>';
}
The ajax_dlists.php (this is the dropdown list I load):
PHP Code:
$sel = mysql_query ("SELECT * FROM searchcats WHERE tafpos='".$count."'");
if ( $arr = mysql_fetch_array($sel) )
{
if ($multiple == "not")
echo '<select id="cat'.$arr['id'].'" name="cat'.$arr['id'].'" style="width:180px; float: left;">';
else
echo '<select id="cat'.$arr['id'].'" name="cat'.$arr['id'].'" style="width:150px; float: left;">';
echo '<option value="">- '.$arr['category'].' -</option>';
$query = "SELECT * FROM searchcatslist WHERE sortby = '".$id."' OR ( sortby = '0' AND cat_id='".$arr['id']."' )";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
echo '<option value="'.$row['id'].'">'.$row['category'].'</option>';
}
echo '</select>';
This post has been edited by danrevah: 20 May 2011 - 07:23 AM

New Topic/Question
Reply


MultiQuote




|