Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic if statement not working
    text
    copied!<p>Why does this code always output $image_issue_message as the message when other options are selected? :( I will also post the form code in a comment so you can see how to values get passed if that helps! I'm quite new to PHP so this is getting over my head now</p> <pre><code> &lt;?php if(!$_POST) exit; $name = $_POST['name']; $email = $_POST['email']; $issues = $_POST['issues']; $message = $_POST['message']; $image_issue_message = "&lt;strong&gt;Unacceptable photo&lt;/strong&gt; - The image that you have submitted has not met the requirements for this website. Photos must be a clear photo of your face (preferably with nobody else in the shot). Photos of cartoon characters, private body parts etc. will not be accepted.&lt;strong&gt; Please attach a suitable photo to your reply email.&lt;/strong&gt;"; $description_issue_message = "&lt;strong&gt;Unacceptable description&lt;/strong&gt; - The description that you have submitted has not met the requirements for this website. Profile descriptions should tell our users a little bit about yourself and what you're looking for. Descriptions that hint that you are on the site looking for sex will not be approved and profile that contain personal or sensitive information cannot be approved either.&lt;strong&gt; Please submit a revised profile description by replying to this email.&lt;/strong&gt;"; $other_issue_message = "&lt;strong&gt;Issues&lt;/strong&gt; - ".$message; $issue_message = ""; if ($issues = "photo") { $issue_message = $image_issue_message; } elseif($issues = "description") { $issue_message = $description_issue_message; } else { $issue_message = $other_issue_message; } if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } $websitepath="http://www.gaymate.co.uk"; // Configuration option. // Enter the email address that you want to emails to be sent to. // Example $address = "joe.doe@yourdomain.com"; //$address = "example@themeforest.net"; $address = $email; // Configuration option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." // Example, $e_subject = '$name . ' has contacted you via Your Website.'; $e_subject = 'Profile rejected by GayMate.co.uk'; // Configuration option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $e_body = ' &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;gaymate.co.uk&lt;/title&gt; &lt;style type="text/css"&gt; p { font-family: Arial; font-size: 12px; padding: 0 20px 0 20px; } .boldTitle { font-size: 13px; font-weight: bold; } .headerTitle { font-size: 16px; font-weight: bold; } .divider2 { padding: 0 20px 0 20px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;table width="500" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td&gt; &lt;!-- YOU CAN PUT AN EMAIL TITLE IMAGE HERE IF YOU WANT --&gt; &lt;p class="headerTitle"&gt;www.GayMate.co.uk&lt;/p&gt; &lt;img class="divider2" src="'.$websitepath.'/images/email/email-divider2.gif" alt="email-divider2" width="460" height="4" /&gt; &lt;p&gt;Hi,&lt;/p&gt;&lt;/br&gt;&lt;p&gt;Your profile has been rejected by the GayMate.co.uk Admin Team. The reasons for rejection are listed below. Please reply to this email with any ammendments needed so that we can make the alterations and get your profile activated right away!&lt;/p&gt; &lt;p&gt;Reason(s) for rejection:&lt;/br&gt; &lt;ul&gt; &lt;li&gt;'.$issue_message.'&lt;/li&gt;&lt;/ul&gt;&lt;/br&gt;&lt;p class="headerTitle"&gt;The Team @ GayMate.co.uk&lt;/p&gt;&lt;/br&gt; &lt;img src="'.$websitepath.'/images/email/email-divider.gif" alt="email-divider" width="500" height="10" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; '; $msg = $e_body; $headers = "From: admin@gaymate.co.uk" . PHP_EOL; $headers .= "Reply-To: admin@gaymate.co.uk" . PHP_EOL; $headers .= "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/html;" . PHP_EOL; if(mail($address, $e_subject, $msg, $headers)) { // Email has sent successfully, echo a success page. echo "&lt;fieldset&gt;"; echo "&lt;div id='success_page'&gt;"; echo "&lt;h1&gt;Email Sent Successfully.&lt;/h1&gt;"; echo "&lt;/div&gt;"; echo "&lt;/fieldset&gt;"; } else { echo 'ERROR!'; } </code></pre> <p>Form code:</p> <pre><code> &lt;form method="post" action="sendreject.php" name="contactform" id="contactform"&gt; &lt;fieldset&gt; &lt;label for="name"&gt;Name&lt;/label&gt; &lt;select name="email" id="email"&gt; &lt;?php while($row_list=mysql_fetch_assoc($list)){ $id = $row_list['id']; $name = ucwords(strtolower($row_list['firstname'])).' '.ucwords(strtolower($row_list['surname'])); $email = $row_list['email']; echo "&lt;option value='".$email."'&gt;".$name."&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;br /&gt; &lt;label for="issues"&gt;Issue(s)&lt;/label&gt; &lt;select name="issues" id="issues"&gt; &lt;option value="photo"&gt;Photo unacceptable&lt;/option&gt; &lt;option value="description"&gt;Profile description&lt;/option&gt; &lt;option value="other"&gt;Other/multiple issues&lt;/option&gt; &lt;/select&gt; &lt;br /&gt; &lt;label for="message"&gt;Reject message&lt;/label&gt; &lt;textarea name="message" cols="40" rows="3" id="message"&gt;&lt;/textarea&gt; &lt;br /&gt; &lt;input type="submit" class="submit" id="submit" value="Submit" /&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload