I have a table and use the following to create a button inside one of the cells:
print("<td> <input type=\"submit\" name=\"toedit\" value=\"Submit\" >
<form action=\"Manage_Customer_Information_refined_list.php\" method=\"post\">
<input type=\"hidden\" value=\"Submit\" name =\"submit_button\" >
</form>
</td>");
When i go to call upon the button (press it) using
if(print_r($_POST["\"submit_button\""]))
{
print "button pressed";
}
It says
undefined index "submit_button"
Please Help :/
Change
<input type=\"hidden\" value=\"Submit\" name =\"submit_button\" >
to
<input type=\"submit\" value=\"Submit\" name =\"submit_button\" >
Remove
<input type=\"submit\" name=\"toedit\" value=\"Submit\" >
try this
print("<td>
<form action=\"Manage_Customer_Information_refined_list.php\" method=\"post\">
<input type=\"hidden\" value=\"Submit\" name =\"submit_button\" >
<input type=\"submit\" name=\"toedit\" value=\"Submit\" >
</form>
</td>");
and if you want to submit on same page then remove Manage_Customer_Information_refined_list.php
form form.
Change your condition to this
if(isset($_POST["submit_button"]))
{
print "button pressed";
}
The code you write <input type=\"hidden\" value=\"Submit\" name =\"submit_button\" >
will be evaluated to ... name="submit_button"
which means you should access this input value from the server side using $_POST["submit_button"].
The way you did write $_POST["\"submit_button\""]
expect the input field to be written as <input type=\"hidden\" value=\"Submit\" name =\"\"submit_button\"\" >
and i don't think that this is a valid syntax, also you should put the submit button inside the form not outside of it.