Page 1 of 1

Not stores select tag value for post varible

Posted: Sat Apr 26, 2014 11:28 pm
by chandananalin2
GET SELECT TAG VALUE and strore php variable

Code: Select all

<script>
function showUser(str) {
    if (str == "") {
        document.getElementById("txtHint").innerHTML = "";
        return;
    }
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    } else { // code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET", "getuser.php?site=" + str, true);
    xmlhttp.send();
    


}
</script>
........................................................................

Code: Select all

$site = null;
if (isset($_POST['site'])) {
    $site = $_POST['site'];
}

echo $site;// doesnt work......
<div id="txtHint"></div>
....................................................................
getuser.php
.............................................................................

Code: Select all

 echo "<select name='company' onchange='showUser(this.value)'>";
    while ($row = oci_fetch_assoc($stmt)) {


      $company = $row['COMPANY_NAME'];
      $company_id = $row['COMPANY_ID'];
        echo ' <option value=' . $company_id . '>';
        echo '<label>' . $company . '[' . $company_id . ']' . '</label>';
        echo '</option>';
    .
    }
    echo ' </select>';

Re: Not stores select tag value for post varible

Posted: Sun Apr 27, 2014 5:09 am
by requinix
What's your question?

Re: Not stores select tag value for post varible

Posted: Sun Apr 27, 2014 5:33 am
by chandananalin2
my code below part not working


$site = null;
if (isset($_POST['site'])) {
$site = $_POST['site'];
}

echo $site;// doesnt work......


not store select tag value in post Please help me

Re: Not stores select tag value for post varible

Posted: Sun Apr 27, 2014 5:35 am
by chandananalin2
if i go to insert query site tag value not store in $site variable.

Re: Not stores select tag value for post varible

Posted: Sun Apr 27, 2014 7:21 am
by chandananalin2
any one help me???????????????????????????///////

Re: Not stores select tag value for post varible

Posted: Sun Apr 27, 2014 7:34 am
by Celauran
Your JS is issuing a GET request and you're checking the POST array...