Jump to content

Recommended Posts

Hey guys,

 

I will try and explain this as clearly as possible:

 

I have a PHP page that displays the f_name, l_name and status for any person of whom their status = 'Pending'.

 

Basically, I have the page set up with one table. In each cell I have <?php echo $f_name ?>, <?php echo $l_name ?>, and <?php echo $status ?>. So if there is more than one record, another table is automatically generated with the second record.

 

Now, next to each record (in each table) I have a two html form buttons: Approve and Deny. The table is surrounded by a form area. If Deny is pressed, then status has to change to 'Denied'. If Approved is pressed, then status has to change to 'Approved'.

 

Here lies two problems: First, I have NO way of differentiating the records from the first table from the records in any other table that was automatically displayed. Second, the records are not displayed in a form element. They are merely a PHP echo. So I cannot POST any of the records. To get around this, I established hidden fields for each cell where the hidden field is = to the PHP echo. This worked, however again, if there are two records, the hidden field elements are set to the records from the last table. The hidden fields for each table will not hold their own distinct records.

 

...ah. I hope I explained that well. Does anyone have any ideas!!!

 

Thanks so much!

 

 

Link to comment
https://forums.phpfreaks.com/topic/78496-question-for-php/
Share on other sites

What is the HTML under the buttons? If they are just type="submit" buttons, then this won't work.

 

You will need to assign 2 radio buttons, properly named, and texted Approve and Deny with a value of 1 or 0 respectively. Then an actual submit button will send those variables to the processing page to act on them.

 

Bottomline is, you can only have one submit per form, and the only workaround is a javascript or AJAX solution.

 

PhREEEk

Link to comment
https://forums.phpfreaks.com/topic/78496-question-for-php/#findComment-397278
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.