Sorry if the title is a bit vague. I want to say that I have the code as shown below:
<?php if(isset($_POST['ccbutton_pressed'])) { if(mail($to, $subject, $msg, $from)){ echo 'Order Sent'; }else{ echo 'Order Sending Error'; } }?> <form method='post' action='SOME_URL_TO_POST_TO' > First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type='hidden' name='hiddenfield1' value='1' /> <input type='hidden' name='hiddenfield2' value='2' /> <input type='submit' value='Submit' /> <input type='hidden' name='ccbutton_pressed' value='1'> </form>
Is there a way to send an email after sending? Noting the following points below:
- prefers php because it is a server part, and information is kept confidential.
- The 'action' attribute must be published and cannot be changed (I need it to go to another page / form)
- Open to use Javascript, while the contents of the message may be hidden in some way (but doubtful)
- I already tried to place the php block that started when the hidden field was set in this form, but in this case it does not work.
Update: Changed the code block to explain more information. This is also not a duplicate, because in Send an email with PHP from the html form when submitting with the same script , the "action" remains empty, while I need my message somewhere.
I would also add that I checked the above article and it does not work for me.
source share