0

hi i have a code like this:

<form action="11.php" method="post">
    <table border="1">
        <tr>
            <th bgcolor="#666600">Action</th>
            <th bgcolor="#666600">Name</th>
            <th bgcolor="#666600">Key Skills</th>
            <th bgcolor="#666600">Qualification</th>
            <th bgcolor="#666600">email</th>
        </tr>
        <?php
            include("connection.php");
            $q="select * from tbl_faculty";
            $result=mysql_query("select * from tbl_faculty");
            while($row=mysql_fetch_array($result))
            {
                echo "<tr><td><input type='submit' id='$row[faculty_id]' name='info' value='Info'><input type='submit' id='$row[faculty_id]' name='edit' value='Edit'><input type='submit' id='$row[faculty_id]' name='Delete' value='Delete'></td><td>$row[FirstName]&nbsp;$row[LastName]</td><td>$row[Keyskills]</td><td>$row[qualification]</td><td>$row[Email]</td></tr>";
            }

        ?>

        <tr>
            <td colspan="5"><input type="submit" id="btn_insert" name="btn_insert" value="Insert" /></td>
        </tr>

</table>

</form>

from this page i want to get values of each button like we use in mysql wamp server.

Edited by Nick Evan: Fixed formatting

4
Contributors
3
Replies
7
Views
6 Years
Discussion Span
Last Post by MagicMedia
0

Hi,

to get the values of the buttons you just have to get the values of the $_POST vars.

For example, in your code, the value $_POST (your first button) is "Info".

Are you sure to really know how to use forms?

0

You should look at approaching this from a different perspective. You are not going to be able to access the ID attribute in the called PHP program. What you are going to need to do is build a link (either in a button or just text) that passes the information to the next page. Your link will contain the mode and the faculty id and look sonething like this.

printf("<a href='11.gif?mode='Edit'&id=%s>Edit</a>", $row['faculty_id']);
printf("<a href='11.gif?mode='Del'&id=%s>Delete</a>", $row['faculty_id']);
printf("<a href='11.gif?mode='Info'&id=%s>Info</a>", $row['faculty_id']);

When the link is selected the values are passed throught the $_GET structure instead ofthe $_POST structure

0

Please put your code in code tags. That is so hard to read. Anyway, just put your id into a hidden input.

<input type="hidden" name="id" value="id"/>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.