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 9143603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:03:43+00:00 2026-06-17T10:03:43+00:00

I have just started my HTTPREQUEST application and I am trying to set up

  • 0

I have just started my HTTPREQUEST application and I am trying to set up my php files first.

I have this insert function on my wamp/www/MenuBook/ folder :

<?php

// array for JSON response
$response = array();

// check for required fields
if (isset($_POST['table_ID']) && isset($_POST['MenuBook']) && isset($_POST['order_status'])&& isset($_POST['order_date'])&& isset($_POST['order_receipt'])) {

    $tableID = $_POST['table_ID'];
    $menuBook = $_POST['MenuBook'];
    $order_status = $_POST['order_status'];
    $order_date = $_POST['order_date'];
    $order_receipt = $_POST['order_receipt'];

    // inlude db connect class
    require_once __DIR__ . '/DBConnect.php';

    // connecting to db
    $db = new DB_CONNECT();

    // mysql inserting a new row
    $result = mysql_query("INSERT INTO orderdb(table_ID,MenuBook,order_status,order_date,order_receipt) VALUES('$table_ID', '$menuBook', '$order_status','$order_date','$order_receipt')");

    // check if row inserted or not
    if ($result) {
        // successfully inserted into database
        $response["success"] = 1;
        $response["message"] = "Order successfully created.";

        // echoing JSON response
        echo json_encode($response);
    } else {
        // failed to insert row
        $response["success"] = 0;
        $response["message"] = "Oops! An error occurred.";

        // echoing JSON response
        echo json_encode($response);
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing";

    // echoing JSON response
    echo json_encode($response);
}
?>

Now I would like to check if it would insert data into the database using my browser something like this :

localhost/MenuBook/insertOrder.php?$table_ID=003&$MenuBook=01&$order_status=PENDING&$order_date=2013-01-17&$order_receipt=NO

as of now it returns this in the browser:

{"success":0,"message":"Required field(s) is missing"}

Any ideas how I could try and check this?

  • 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-06-17T10:03:45+00:00Added an answer on June 17, 2026 at 10:03 am

    This will not insert data because:

    1. You are passing variables in URL (GET Method) and using them in your script using $_POST.
    2. Also you have not even correctly passed the variables in URL it must be table_ID, MenuBook etc instead of $table_ID,$MenuBook.

    The solution is either user $_GET or $_REQUEST in your script or if possible pass the values using POST method (an better choice).

    For testing:
    If you have used $_GET or $_REQUEST in your script, simply copy-paste the generated URL into the browser and have a test run.
    Else if have used POST create a sample form(If you don’t have) and submit it to have a test.

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

Sidebar

Related Questions

I have just started learning python version 3 and trying to create a file
I have just started to use Ajax/ws and i have faced this question: Why
Have just started converting an existing job tracking system into an ASP.NET MVC application.
I have just started to develop a brand new application and I have two
I have just started learning Qt and compiled and executed this spinet #include <qapplication.h>
I have just started to do some coding with Access and trying to create
I have just started with PHP development since last week. I have installed XAMPP
I have just started to learn asp.net MVC3 and i run into this problem:
I have just started playing with Clojure and the first thing I thought I'd
I have just started building app with sencha touch 2 I was trying to

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.