Home > Mobile >  How to make edit button with php, html only no mysql
How to make edit button with php, html only no mysql

Time:11-09

I want to bring many $_REQUEST from Tag but only $_REQUEDT['editid'] works. how to solve it.

 echo "<td><a href=product.php?editid=$id, editname=$name, editqty=$qty, editprice=$price>Edit</a></td>";

//when I put $_REQUEST['editid'] in input it works but others not.

<form action="product.php">
    <table> 
            <tr>
                <td>ID</td>
                <td><input type="text" name="tid" value="<?php if(isset($_REQUEST['editid'])){echo $_REQUEST['editid'];} ?>"></td>
            </tr>
            <tr>
                <td>Name</td>
                <td><input type="text" name="tname" value="<?php if(isset($_REQUEST['editname'])){echo $_REQUEST['editname'];}?>"></td>
            </tr>
            <tr>
                <td>Qty</td>
                <td><input type="text" name="tqty" ></td>
            </tr>
            <tr>
                <td>Price</td>
                <td><input type="text" name="tprice" ></td>
            </tr>
            
            <tr>
                <td></td>
                <td><button type="submit" name="btn-add">Add</button>
                <button type="submit" name="btn-clear">Clear</button></td>
                
            </tr>
        </table>
    </form>

CodePudding user response:

The URL parameters after the 1st one should be separated by & (not ,)

Change from

<a href=product.php?editid=$id, editname=$name, editqty=$qty, editprice=$price>

to

<a href="product.php?editid=$id&editname=$name&editqty=$qty&editprice=$price">
  • Related