0

Hi guys,

I am using a number of checkboxes and I want to get their value using POST method, but my problem is that I use two buttons at the end! Buttons "Accept" and "Reject"
If accept is pressed I want to know it so I can make different process on them, if reject is pressed again I want to know it.

Here is what I use up to know but I haven't manage to get it work if reject is pressed instead of accept

<?php
 
   $value = $_POST['chk'];
 
   //if accept is pressed
   //do this...
   //else if reject is pressed
   //do this...

?>

<form action='test.php' method='post'>
<input type='checkbox' name='chk[]' value='value1'>VALUE 1<br>
<input type='checkbox' name='chk[]' value='value2'>VALUE 1<br>
<input type='checkbox' name='chk[]' value='value3'>VALUE 1<br>
<input type='checkbox' name='chk[]' value='value4'>VALUE 1<br>
<input type='submit' name='submit' value='Accept'>
<input type='submit' name='submit' value='Reject'>
</form>
2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by smantscheff
1

//if accept is pressed
if ($_POST == 'Accept') {
//do this...
}
//else if reject is pressed
if ($_POST == 'Reject') {
//do this...
}

if($problem == "solved"){
  clickLink("mark_as_solved");
}

Edited by smantscheff: n/a

Votes + Comments
great and works perfect
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.