0

I have a table contains Orders data that was retrieved from a data base and there is a field called "status" contains a form with select options and a hidden input with the value of the order ID.. the issue that the form doesn't seem passing the data to the php file that will run the function.

I tried both POST and GET methods and what I noticed that the data are passed in the URL leading to the php file but with blank page.

this is the URL to show the parameters:

http://localhost/project_name/test2.php?submit.x=15&submit.y=22&status=new&orderId=190406053842

here is my HTML form

<td>
        <form action="test2.php" method="GET">
        <input type="image" name="submit" src="icons/submit.png" alt="Submit" style='width:30px;height:30px;border:0;' onclick="confirm('are you sure?')"> 
        <select name="status">
            <option value="new">new</option>
            <option value="checking">checking</option>
            <option value="processing">processing</option>
            <option value="done">done</option>
          </select>
          <input type="hidden" name="orderId" value="<?php echo $row["ORDER_ID"]; ?>">
          </form>
</td>

this is the php file (just echoing the result to make sure it works and proceed onwards)

    <?php
    $db = mysqli_connect('localhost', 'root', '', 'project_name');


            if(isset($_GET['submit'])){
                $status = $_GET['status'];
                $ID = $_GET['orderId'];

    echo $staus;
    echo $ID;
}
    ?>  

thank you.

1
  • 1
    Hi Emma thanks for welcoming me! .. oops I messed pasting that bracket so unfortunately nothing is wrong so far. thanks anyway! Commented Apr 7, 2019 at 6:28

1 Answer 1

2

If you look at your GET URL string there is no 'submit' variable, so checking for a 'submit' variable is not going to work.

It looks like it is appending co-ordinates to the 'submit' variable so its actually outputting 'submit.x' and 'submit.y'. I've never used the image input type before so can only guess this is the intended functionality of this input type.

You could get around this by checking for the 'orderID' instead of 'submit'. Or you could try 'submit.x' or 'submit.y'.

Sign up to request clarification or add additional context in comments.

1 Comment

OK that's what it means.. guess I should try another type or change the whole tag to submit the form. thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.