Jump to content

PHP linked to button


Chronix

Recommended Posts

Hi all, first time posting here and wondering if anyone can help me.

 

Ive linked a button in a HTML so that it sends an email to me. But the thing thats really bugging me is that sometimes it sends the persons email address and sometimes it doesnt AND ALSO ive got multiple boxes in my HTML that I want it to send but it will only send 1 and not all 5. This is what my PHP looks like at the moment:

 

<?php
  $email = $_REQUEST[ 'email_box' ] ;
  $message = $_REQUEST[ 'test1_box' ] ;
  $message = $_REQUEST[ 'test2_box' ] ;
  $message = $_REQUEST[ 'test3_box' ] ;
  $message = $_REQUEST[ 'test4_box' ] ;
  $message = $_REQUEST[ 'test5_box' ] ;

  mail( "[email protected]", "Test Feedback sheet",
    $message, "From: $email" );
?>

 

Can you please tell me where I have gone wrong? I really need this to be sorted out and im completely new to PHP, ive only just gotten past basic knowledge of html


Link to comment
https://forums.phpfreaks.com/topic/219832-php-linked-to-button/
Share on other sites

Thanks for the help, I got the email to work properly now but im having problems with the php page loading a HTML after it has submitted the email. Heres the code im using:

 

<?php
  $email = $_POST[ 'email_box' ] ;
  $message1 = $_POST[ 'test1_box' ] ;
  $message2 = $_POST[ 'test2_project_box' ] ;
  $message3 = $_POST[ 'test3_box' ] ;
  $message4 = $_POST[ 'test4_box' ] ;
  $message5 = $_POST[ 'test5_box' ] ;

   mail("[email protected]", 'Test Email Feedback Form', "test email: ".$email."\n\ntest1: ".$message1."\n\ntest2: ".$message2."\n\ntest3:".$message3."\n\ntest4: ".$message4."\n\ntest5: ".$message5, "From: $email");
header( 'Location:thankyou.html' ) ;
?>

 

Whats gone wrong? It keeps saying Warning: Cannot modify header information - headers already sent by everytime sendmail.php loads

You can't send headers after they've already been sent. I.e. you can't use a header() redirect if there has already been any output at all to the browser, even as little as a single space or character.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.