Jump to content

92-3kgt

New Members
  • Posts

    2
  • Joined

  • Last visited

92-3kgt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm not sure who to thank first haha but thank you guys both!!! I posted on Stack overflow but most of what they were doing/saying didn't quite make sense (and one of the snippets someone posted didn't work either). I owe you guys a beer or something!
  2. So i am no PHP guru and i have barely coded in it (mostly HTML changes inside a PHP script). I have a basic setup on the page i am working on. The page has 4 buttons, they are all sending an email report to our service desk email to report any printer issues in our print labs. I have the email sending working and coded. The issue is that each button has to submit a different coded email to the service desk. I have the four buttons as images (not a lot of people like the boring normal buttons) here is the code: <form action="" method="post"> <br/> <br/> <h2>Please select issue</h2> <br/> <input type="image" src="testing/images/need_toner.png"/> <input type="hidden" name="toner" id="toner" tabindex="1" /> <input type="image" src="testing/images/paper_jam.png" /><br> <input type="hidden" name="paper-jam" id="paper-jam" tabindex="2" /><input type="image" src="testing/images/printer_fault.png" /> <input type="hidden" name="printer-fault" id="printer-fault" tabindex="3" /> <input type="image" src="testing/images/other.png" /> <input type="hidden" name="other" id="other" tabindex="4" /> </form> So the buttons come out fine and look good and all that but when you click on any of the buttons it only executes the first PHP if code and ignores to check the others. Here is my PHP code (keep in mind i am not really a PHP person, i just know some general coding. <?php $url = 'testing/floor4/marketing'; // Setting the URL parameter for PHP if(isset($_POST['toner'])) { $to = 'XXX@XXX.com'; $subject = 'TONER NEEDED - AKRON_32 Marketing Printer'; $message = 'A request for toner has been reported for printer AKRON_32 on the 4th floor in the marketing department.'; $headers = 'From: XXX@XXX.com' . "\r\n" . 'Reply-To: XXX@XXX.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header('Refresh: 6;URL=testing/floor4/marketing' ); echo '<center><h2>Report Sent! - Page will refresh after a few seconds.</h2></center>'; } if(isset($_POST['printer-fault'])) { $to = 'XXX@XXX.com'; $subject = 'PRINTER FAULT - AKRON_32 Marketing Printer'; $message = 'A printer fault has been reported for printer AKRON_32 on the 4th floor in the marketing department.'; $headers = 'From: XXX@XXX.com' . "\r\n" . 'Reply-To: XXX@XXX.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header('Refresh: 6;URL=testing/floor4/marketing' ); echo '<center><h2>Report Sent! - Page will refresh after a few seconds.</h2></center>'; } if(isset($_POST['paper-jam'])) { $to = 'XXX@XXX.com'; $subject = 'PAPER JAM - AKRON_32 Marketing Printer'; $message = 'A paper jam has been reported for printer AKRON_32 on the 4th floor in the marketing department.'; $headers = 'From: XXX@XXX.com' . "\r\n" . 'Reply-To: XXX@XXX.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header('Refresh: 6;URL=testing/floor4/marketing' ); echo '<center><h2>Report Sent! - Page will refresh after a few seconds.</h2></center>'; } if(isset($_POST['other'])) { $to = 'XXX@XXX.com'; $subject = 'OTHER - AKRON_32 Marketing Printer'; $message = 'An issue marked "other" has been reported for printer AKRON_32 on the 4th floor in the marketing department.'; $headers = 'From: XXX@XXX.com' . "\r\n" . 'Reply-To: XXX@XXX.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header('Refresh: 6;URL=testing/floor4/marketing' ); echo '<center><h2>Report Sent! - Page will refresh after a few seconds.</h2></center>'; } ?> So the code isn't the best structured i am sure so if you can help me out that'd be awesome, like i said i am no PHP coder. It's just weird how i originally had the coding working fine before i changed the echo text and had it redirect the headers no it just ONLY executes the first email for toner. I am also very sorry this script is sloppy and potentially not structured correctly? I've been piecing together snippets from different sites
×
×
  • 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.