Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7162957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:49:14+00:00 2026-05-28T13:49:14+00:00

I have a html form which the user inputs values/selects options. After selecting, these

  • 0

I have a html form which the user inputs values/selects options. After selecting, these values would be sent to the php script in the server. The script would be retrieving some data from mysql depending on the values the user selected. These values and data from mysql would then be collated together and used in a POST request which would be sent to a mobile device. I would be using curl to do the request.

However, I’m unable to do any POST request. I’m not seeing any results or changes. I tried doing echo in my php script but it’s not printing out on the html form even if I used GET

Where did I go wrong in my code?

.html

<script type="text/javascript">

    function doSubmit() {

        var env = document.frm.Env.value;
        var appname = document.frm.appname.value;
        var target = document.frm.target.value;
        var messages = document.frm.messages.value;

        var strURL = "sendMessage.php?Env=" +env+ "&appname=" +appname+ "&target=" +target+ "&Message=" +messages;

        xmlhttp.open("GET",strURL,true);
        xmlhttp.send(null);

    }
</script>

</head>

<body>

    <form action="">
        Environment: <div id="Env">
            <select name="customers" onchange="showApplications(this.value)">
                <option value="Environment">Select an environment</option>
                <option value="S">Sandbox</option>
                <option value="P">Production</option>
            </select>
        </div>

        </br>

        Application Name: <div id="appname">
            <select name="appname" onchange="showTargets(this.value)">
                <option value="">Select application</option>
            </select>
        </div>

        </br>

        Target Device : <div id="target">
            <select name="target">
                <option>Select Device OS</option>
            </select>
        </div>
        </br>
        Message: <div id="messages"><input type="text" name="Message" maxlength="200" size="50"></input></div>

        </br>

        <input type = "button" value="Send" onclick="doSubmit();">
    </form>

    </br>

</body>
</html>

.php

<?php
$env      = mysql_real_escape_string($_POST["env"]);
$appname  = mysql_real_escape_string($_POST["appname"]);
$target   = mysql_real_escape_string($_POST["target"]);
$messages = mysql_real_escape_string($_POST["messages"]);


$conn = mysql_connect("127.0.0.1:3306", "root", "");
mysql_select_db("PushApplication", $conn);

if ($target == "All") {
    echo "Hi";
} elseif ($target == "Apple") {
    echo "Apple";
    $query  = "select deviceID from Device where DeviceType='$target'";
    $result = mysql_query($query);

    $num = mysql_numrows($result);

    $i = 0;
    while ($i < $num) {
        $myResult = mysql_result($result, $i);
        $url      = "http://10.28.68.28:8899/?Env='$env'&AppName='$target'&Token='$myResult'&Message=%7B%22aps%22%3A%7B%22alert%22%3A%22'$messages'%22%7D";
        echo $url;
        curl $url
        ++$i;
    }
}

else
    echo "Hi!";
?>

</select>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:49:14+00:00Added an answer on May 28, 2026 at 1:49 pm

    You are not outputing anything from your AJAX request. If you are using XMLHttpRequest, you need to define onreadystatechange() method of it and, there, output result in some conditions. But, instead, I advice you to use something like jQuery Ajax, it is much easier and supports huge variety of browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this html form which has options: <tr> <td width=30 height=35><font size=3>*List:</td> <td
I have a post html form, and the action is index.php, which is the
I have a simple HTML form which consists of radio buttons where user has
I have this html form which calls a php file . The index.html ->
I have a html form which have a select list box from which you
I have a an HTML form which contains the YAHOO rich text editor on
I have an HTML form generated by JSF which maps an input element to
I have a html form for uploading a file, which is as follows: $uploadhtml
I have a html page with a form. The form has Div which gets
I have a webrequest that returns a html response which has form inside with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.