Not stores select tag value for post varible

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
chandananalin2
Forum Newbie
Posts: 5
Joined: Sat Apr 26, 2014 11:18 pm

Not stores select tag value for post varible

Post 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>';
Last edited by Celauran on Sun Apr 27, 2014 7:32 am, edited 1 time in total.
Reason: Formatting. Please use syntax tags to keep your code legible.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Not stores select tag value for post varible

Post by requinix »

What's your question?
chandananalin2
Forum Newbie
Posts: 5
Joined: Sat Apr 26, 2014 11:18 pm

Re: Not stores select tag value for post varible

Post 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
chandananalin2
Forum Newbie
Posts: 5
Joined: Sat Apr 26, 2014 11:18 pm

Re: Not stores select tag value for post varible

Post by chandananalin2 »

if i go to insert query site tag value not store in $site variable.
chandananalin2
Forum Newbie
Posts: 5
Joined: Sat Apr 26, 2014 11:18 pm

Re: Not stores select tag value for post varible

Post by chandananalin2 »

any one help me???????????????????????????///////
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Not stores select tag value for post varible

Post by Celauran »

Your JS is issuing a GET request and you're checking the POST array...
Post Reply