Code working in Chrome but not in Firefox

后端 未结 2 1293
遇见更好的自我
遇见更好的自我 2021-01-16 06:13

The following code works in Chrome. But in Firefox the submit step is not working


相关标签:
2条回答
  • 2021-01-16 06:31
    <?php
    if(!isset($_POST['submit'])){
            $id=$_POST['std_no']; // put it here so whenever you click submit button
            echo $id; // $_POST is trigger
    
    ?>
    <form action="/**input action**/" method="post">
    <b>ID:</b>
    <input name="std_no" type="text" />
    <input type="image" width="100" value="submit" name="submit" id="submit" src="images/butup.gif" alt="submit Button">
    </form>
    

    you should input in action=""; // the php page of your code or the page where you want to get the data sample page.php

    or try this

    <?php echo htmlentities($_SERVER['PHP_SELF']); ?> // put in action
    
    0 讨论(0)
  • 2021-01-16 06:36

    The issue is that an image submit doesn't send the name "submit" it sends "submit_x" and "submit_y"

    So you should check for

    if (isset($_POST['submit_x']))...
    

    EDIT: I've done a little more testing on this and it appears in Firefox (16) and IE(7, 8, 9) only the x and y get sent whereas in Chrome (23) and Safari (5.1) it also send the name too along with x and y.

    So the safest way is to check for the value is : isset($_POST['name_x'])

    0 讨论(0)
提交回复
热议问题