www.webdeveloper.com
Results 1 to 5 of 5

Thread: Help with grabbing value from jquery generated select tag

  1. #1

    Help with grabbing value from jquery generated select tag

    Hi All, I have code that dynamically retrieves data with jquery AJAX. when i want to insert data into database via PHP $_POST method it cannot grab select tag (option) value in Mozilla and Chrome. But it works perfectly in IE.
    Below is my code.
    PHP Code:


        <?php
        
    if($_GET['func'] == "drop_1" && isset($_GET['func'])) {
        
    drop_1($_GET['drop_var']);
        }
        function 
    drop_1($drop_var)
        {
        include_once(
    'db.php');
        
    $tablet='table'.$drop_var;
        
    $active='active';
        
    $result mysql_query("SELECT * FROM $tablet where mid='$drop_var' AND act='$active'") or die(mysql_error());
        echo 
    '<div class="styled-select">';
        echo 
    '<select name="region"><option value="bir" disabled="disabled" selected="selected">Secin...</option>';
        while(
    $drop_2 mysql_fetch_array$result ))
        {
        echo 
    '<option value="'.$drop_2['id'].'">'.$drop_2['name'].$drop_2['id'].'</option>';
        }
        echo 
    '</select>';
        echo 
    '</div>';
        }
        
    ?>
    Thank you for attention

    submenu.php

    PHP Code:

        <?php
        
    if($_POST){ foreach($_POST as $key=>$value){ $$key=$value;} }
        if(isset(
    $_POST['addmenu'])){
        if(
    $drop_1!="bir" && $_POST['region']!="bir"){
        
    $values="values('', '$secim', '$drop_1', '".$_POST['region']."', '$menu')";
        
    $nactive='nactive';
        
    $table='table'.$drop_1;
        
    $func->seher('submenular'$values);
        
    mysql_query("UPDATE $table SET act='".$nactive."' where id='".$_POST['region']."'");
        
    Header("Location: index.php?do=addsubmenu");
        }
        }
        
    ?>
    Attached Files Attached Files

  2. #2
    Can anyone help me?

  3. #3
    Join Date
    Jan 2009
    Posts
    3,346
    Have you tried print_r($_POST) to see what is actually being passed? Not sure I can be much help without the AJAX calls...

  4. #4
    It does all good in IE. for ex it shows in IE like that
    PHP Code:
    Array
    (
        [
    secim] => 35
        
    [drop_1] => 3
        
    [title] => 
        [
    region] => 27
        
    [menu] => new
        [
    addmenu] => daxil et

    but in Mozilla and Chrome

    PHP Code:
    Array
    (
        [
    secim] => 35
        
    [drop_1] => 3
        
    [title] => 
        [
    menu] => new
        [
    addmenu] => daxil et

    In mozilla and Chrome it misses
    PHP Code:
     [region] => 27 
    cannot grab jquery generated select tag value. why?

  5. #5
    Join Date
    Jan 2009
    Posts
    3,346
    Do you have both a name and id for the select tag? I remember something about needing both awhile back, though I can't remember why that was at the moment.

    Might need to share the jquery code since it is likely in there that it is not passing the expected key=>value pairs.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles