0

I have a page that prints out rows of information. In each row is a notes box:

<?php
<td style='font-size:12px;width:300px;'>
{$row['Notes']} <br /><center><br />
    <form action=\"http://********/functions/notes.php\" id='formNotesform' method='post'>
    <input type='hidden' id='ID' name='ID' value='{$row['ID']}' />

    <textarea placeholder=\"Add more notes here...\" name=\"notes\" rows=\"5\" cols=\"30\"'></textarea><br />
    <input type='submit' name='formNotes' id='formNotes' value='Add to Notes' />
    </form>

</center></td>
?>

Then there's also another button on the page in each row.

    <form action=\"http://********/functions/archive.php\" method='post' id='formArchiveform' onclick=\"return checkArchive()\">
    <input type='hidden' id='ID' name='ID' value='{$row['ID']}' />
    <input type='submit' name='formArchive' id='formArchive' value='Archive' style=\"height:25px; width:80px\"/>
    </form>

What I need to happen is that when someone clicks the "Add to Notes" button it does its job but when someone clicks the "archive" button it checks to see if notes is empty and if not then it submits that as well (kind of like a failsafe).

Ideally I'd like to just pick up the Notes data and post it to the archived.php file the form is going to anyways since that would cause minimal disruption to the code base but I can't get it to work.

I understand this isn't really a sensible choice. It just has to be done. Thanks for the help!

new2programming
  • 257
  • 1
  • 9
  • I just need to be able to submit the archive form to archived.php and be able to access the contents of the notes box even though that form was never submitted. – new2programming Jul 08 '15 at 14:04

1 Answers1

0

If I had reputation I would ask first because what I understood is that you want to now what button has been pressed to then do another things.

If that's it do this:

if($_SERVER['REQUEST_METHOD'] == 'POST')
{
  if(isset($_POST['formNotes']))
  {
  //...
  }
  elseif(isset($_POST['formArchive']))
  {
  //...
  }
}
otherOne
  • 52
  • 7