0

I have radio in php, it is included in the form tags which has post method. I have a delete button in different div and different form

So I have this

<td style="text-align: center;">
         <input type="radio" name="equipment" value="1" > 
     </td>

and then in the other div and form I have this:

<div class="col-lg-1">
 <form method="POST">
     <button type="submit" class="btn btn-danger" name="delete">Delete</button>
 </form>
 </div>

and then at the top of my php file I have this:

if(isset($_POST['delete']))
 {
$equipment = $_POST['equipment']; //as you notice this equipment comes from my radio input from the first example above. And the error is here.
echo "<script>";
echo "alert('".$equipment;
echo "'); </script>";
 }

So I have this problem for many hours now since yesterday. When I click delete button it shows alert box but after i close it, I get Notice: Undefined Index: equipment in ../etc/phpfile:lineNumber. Basically the error links me to the line number of this code $equipment = $_POST['equipment'];

How would I resolve this problem because I want to get the radio value to manipulate mysql using php in later time. For now, I want to output it in alert box.

rochiey
  • 29
  • 7

0 Answers0