Hello Everyone,
I have a form that allow users to enter data, based on their input I can either accept or deny data.
Since there is many different reasons to deny a submission and I can not list all I was thinking to add a text area field where I can explain the reasons.
Presently it is by saying “Your submission has been denied”
Can someone tell me where the code should be written? in form2.php or Deny.php and how to set this code up
Form2.php
Approve: ".$where_form_is."approve.php?id=".$formId."
Deny: ".$where_form_is."deny.php?id=".$formId."
Deny.php
<?php
if(!isset($_GET['id'])){ die('Error: no ID given.'); }
else if(!is_numeric($_GET['id'])){ die('Error: ID is not an integer.'); }
$connection = mysql_connect('localhost','xxxx_xxx','xxx') or die ("Couldn't connect to server.");
$db = mysql_select_db('xxx_xxx', $connection) or die ("Couldn't select database.");
$query = @mysql_query('SELECT * FROM `ihsreg` WHERE `id` = "'.$_GET['id'].'"') or die('Error: ID not found.');
if(!@mysql_result($query,0)) die('Error: ID not found.');
$query = @mysql_query('SELECT `SubmitEmail` FROM `ihsreg` WHERE `id` = "'.$_GET['id'].'"') or die('Error: could not find submitter\'s email in the database. The submission has been denied, but the submitter will not receive an email.');
$SubmitEmail = @mysql_result($query,0);
$query = @mysql_query('DELETE FROM `ihsreg` WHERE `id` = "'.$_GET['id'].'"') or die('Error: ID not found.');
if(@mail($SubmitEmail, "Your submission has been denied!", "Hello,\n\nYour submission to the xxxxx xxxxx xxxxxxr has been received and denied!", "From: xxxxx xxxxx xxxxx")){
echo '<h1>Denied!</h1><p>You have successfully denied this submission. The submitter should now receive an email that confirms his submission was denied.</p>';
} else {
echo '<h1>Denied!</h1><p>You have successfully denied this submission. However, due to an error, the submitter may not receive his confirmation email.</p>';
}
?>