greens85 Posted February 22, 2010 Share Posted February 22, 2010 Hi all, I have one variable that isn't posting, but the rest are working fine. The code is below: candidateenquire.php, this is responsible for detailing all the credentials of the candidate etc. <form action="processcandidateenquiry.php" method="post"> <?php $id = $_GET['candidateid']; $query = "SELECT * FROM my_table WHERE id = $id"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); ?> <span class="bold">About the Candidate:</span> <br/> <span class="bold"><font color="#FF0000">Please note, for confidentiality reasons we do not display the candidates name.</font></span> <br/> <br/> <b>Candidate ID</b><br/> <input type="text" name"candidateid" id="candidateid" class="bodyinput" value="<?php echo $row['id'];?>"/> <br/> <br/> <div class="hr"></div> <br/> <span class="bold">About You:</span> <br/> <span class="bold"><font color="#FF0000">If any of your contact details are incorrect, please feel free to amend them.</font></span> <?php $query = "SELECT * FROM different_table WHERE username='$_SESSION[username]'"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); ?> <br/> <br/> <span class="bold">Contact Name</span> <br/> <input type="text" name="contactname" id="contactname" class="bodyinput" value="<?php echo $row['contactname'];?>"/> <br/> <br/> <span class="bold">School Name & Address</span> <br/> <br/> <span class="bold">Name</span><br/> <input type="text" name="schoolname" id="schoolname" class="bodyinput" value="<?php echo $row['schoolname'];?>" /> <br/> <br/> <span class="bold">Street</span><br/> <input type="text" name="street" id="street" class="bodyinput" value="<?php echo $row['street'];?>"/> <br/> <br/> <span class="bold">Town</span><br/> <input type="text" name="town" id="town" class="bodyinput" value="<?php echo $row['town'];?>"/> <br/> <br/> <span class="bold">County</span><br/> <input type="text" name="county" id="county" class="bodyinput" value="<?php echo $row['county'];?>"/> <br/> <br/> <span class="bold">Postcode</span><br/> <input type="text" name="postcode" id="postcode" class="bodyinput" value="<?php echo $row['postcode'];?>"/> <br/> <br/> <span class="bold">Phone</span> <br/> <input type="text" name="schoolphone" id="schoolphone" class="bodyinput" value="<?php echo $row['telephone'];?>" /> <br/> <br/> <span class="bold">Contact Email</span><br/> <input type="text" name="schoolemail" id="schoolemail" class="bodyinput" value="<?php echo $row['contactemail']; ?>" /> <br/> <br/> <div class="hr"></div> <br/> <span class="bold">Addtional Comments:</span> <br/> <span class="bold"><font color="#FF0000">Please enter any additional comments you may have.</font></span> <br/> <br/> <b>Your Comments</b> <br/> <textarea name="additional" id="additional" cols="40" rows="5" class="bodyinput"></textarea> <input type="submit" name="submit" id="submit" value="Send Enquiry" class="bodyinput"/> </form> Once the submit button is pressed, we move onto processcandidateenquiry.php... this is where I want to email the results of the boxes to an email address... I am getting all the variables sent except for candidate ID... The code for this page is: <?php include("CMS/dbconnection.php"); function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field = filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } //check if the email address is invalid $mailcheck = spamcheck($_POST['schoolemail']); if ($mailcheck==FALSE) { } else { //send email $candidateid = mysql_real_escape_string($_POST['candidateid']); $contactname = mysql_real_escape_string($_POST['contactname']); $schoolname = mysql_real_escape_string($_POST['schoolname']); $street = mysql_real_escape_string($_POST['street']); $town = mysql_real_escape_string($_POST['town']); $county = mysql_real_escape_string($_POST['county']); $postcode = mysql_real_escape_string($_POST['postcode']); $schoolphone = mysql_real_escape_string($_POST['schoolphone']); $schoolemail = mysql_real_escape_string($_POST['schoolemail']); $additional = mysql_real_escape_string($_POST['additional']); $to = "[email protected]"; $subject = "Candidate Enquiry"; $emailbody = "<table width='100%' border='0'> <tr> <td><div align='left'><a href='http://www.my-site.co.uk'><img src='http://www.my-site.co.uk/path/images/image.gif' border='0' alt='Alt'></a></div></td> <td></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan='2'><strong>$schoolname</strong> have expressed an interest a candidate. The full details of this enquiry can be seen below, including contact details for the school & any additional comments they have made.</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><strong>Candidate Details</strong></td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td style='background-color:#CCCCCC;'>Candidate ID:</td> <td style='background-color:#CCCCCC;'>$candidateid</td> </tr> <tr> <td>Candidate Name:</td> <td>$candidatename</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><strong>Contact Details</strong></td> <td></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td style='background-color:#CCCCCC;'>Name:</td> <td style='background-color:#CCCCCC;'>$contactname</td> </tr> <tr> <td>Telephone:</td> <td>$schoolphone</td> </tr> <tr> <td style='background-color:#CCCCCC;'>Contact Email:</td> <td style='background-color:#CCCCCC;'>$schoolemail</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><strong>School Details</strong></td> <td></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td style='background-color:#CCCCCC;'>School Name:</td> <td style='background-color:#CCCCCC;'>$schoolname</td> </tr> <tr> <td>Street:</td> <td>$street</td> </tr> <tr> <td style='background-color:#CCCCCC;'>Town:</td> <td style='background-color:#CCCCCC;'>$town</td> </tr> <tr> <td>County:</td> <td>$county</td> </tr> <tr> <td style='background-color:#CCCCCC;'>Postcode</td> <td style='background-color:#CCCCCC;'>$postcode</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Comments:</td> <td>$additional</td> </tr> </table>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=sio-8859-1\r\n"; $headers .= "FROM: [email protected]"; mail($to, $subject, $emailbody, $headers); } ?> Anyone got any ideas on why this isn't working, it's obvious that the id variable isn't being sent to the next page... I just can't understand why when it's using the same methods as the other variable which all work fine!!! Many thanks. Link to comment https://forums.phpfreaks.com/topic/192927-one-variable-not-posting-but-rest-are-ok/ Share on other sites More sharing options...
teamatomic Posted February 22, 2010 Share Posted February 22, 2010 name"candidateid" HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/192927-one-variable-not-posting-but-rest-are-ok/#findComment-1016092 Share on other sites More sharing options...
greens85 Posted February 22, 2010 Author Share Posted February 22, 2010 Can't believe I've been on with this all morning and I've been overlooking a missing = sign... Thanks so much, I may never of spotted that! Link to comment https://forums.phpfreaks.com/topic/192927-one-variable-not-posting-but-rest-are-ok/#findComment-1016098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.