hi i have a code like this:

<form action="11.php" method="post">
    <table border="1">
            <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>
            $q="select * from tbl_faculty";
            $result=mysql_query("select * from tbl_faculty");
                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>";


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



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

Recommended Answers

All 3 Replies


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?

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

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"/>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.