Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Ajax posting in the same page

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36264
    vithra
    Member

    hi

    i tried to populate the select box value based on the selection in another select box and i post that value through ajax posting, and in the second select box if i select any one of the value, rest of the elements in the page must get the data from database based on the value of second select box which i passed it using ajax in the same page but the php in that page doesn’t receive that value. can any one tell how to pass the selected value using ajax in the same page.
    main file

    $db = mysql_connect('localhost', 'root', '') or die(mysql_error());
    mysql_select_db('mobitara', $db) or die(mysql_error());
    $user= $_SESSION;
    [email protected]$_GET;
    echo $v1;
    $v2='hots';
    $sql2=mysql_query("select * from userpro where fname='$v1' and pos='$v2' ");
    while($res=mysql_fetch_assoc($sql2))
    {
    ?>




    mysql_select_db('mobitara', $db) or die(mysql_error());
    [email protected]$_GET;
    $v2='hots';
    $sal=mysql_query("select username from userpro where fname='$v1' and pos='$v2' ");
    while($v3=mysql_fetch_assoc($sal))
    {
    $user1=$v3;
    }
    $video ="video";
    $sql0 = "SELECT path FROM `hotzprofile` "
    ." WHERE `name`='$user1' and type = '$video' ";
    $result0=mysql_query($sql0);
    while($row1=mysql_fetch_assoc($result0))
    {

    $va1= $row1;

    ?>

    }
    $photo ="photo";
    $sql = "SELECT path FROM `hotzprofile` "
    ." WHERE `name`='$user1' and type = '$photo' ";

    $result1=mysql_query($sql);
    while($row=mysql_fetch_assoc($result1))
    {

    $var1= $row;
    $pieces = explode(",", $var1);
    foreach($pieces as $key=>$value)
    {

    ?>

    }
    }
    ?>


    php file


    if (!$link) {
    die('Could not connect: ' . mysql_error());
    }
    mysql_select_db('mobitara',$link);
    $position='hots';
    $sql1="select * from userpro where job='$type' and pos='$position'";
    $result1=mysql_query($sql1);

    ?>

    #96156
    soap
    Participant
    #96163
    bungle
    Member

    I haven’t looked to see what else might be wrong but you are using a PHP variable in your script at the top outside of php

    xmlhttp.open(“GET”,”$_SERVER[PHP_SELF]?person=”+person,true);

    needs to be

    xmlhttp.open(“GET”,”?person=”+person,true);

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.