I have a web form that when a user submits it inserts into an SQL database and also sends an email advising of certain details in the form. The email sends through fine but the variables are empty. When I check the sendEmail.php in the console it returns the following error…
PHP Notice: Undefined index: problemdescript in D:\inetpub\wwwroot\SMT_Request_DevWIP\board\sendEmail.php on line 2
I’ve been following this question regarding changing the $_POST to a get or vise versa but the variables remain blank.
This is the sendEmail.php code…
<?php
$details = $_GET['problemdescript'];
$to = "[email protected]";
$subject = "SMT Internal RFA: A new job has been created";
$message = "
Ticket details: $details \n
Please click the following link to access the SMT Track & Trace system
and view the ticket:
http://gbsuk0pcdspdsql/SMT_Request_Dev/board/loginPage.php";
$headers = "Cc: [email protected]";
mail($to,$subject,$message,$headers);
?>
And here is my index.php which contains the form (which i’ve slimmed down as it’s a rather large form)…
<form id="newForm" action="sendEmail.php" method="post" enctype="multipart/form-data">
<label for="problem"><b>Problem Description:</b></label><br>
<textarea id="problemdesc" name="problemdescript" style='background-color: #ffff99'; cols="100" rows="4" style="resize:none" placeholder="Please provide as much information as possible..."></textarea>
</form>
I want whatever is written in the ‘problemdescript’ textarea to be displayed within the email but so far can’t get anything back. Any help would be greatly appreciated.