emilysnothere Posted January 22, 2010 Share Posted January 22, 2010 I have created a form using my FormClass.php however once submitted it emails me all the values except those that are from a drop down select or radio box. Theres probably a quick fix to this so if anyone has any ideas please help me here are some examples of my code: Drop down menu: //list of all countries displayed in a drop down select function selectCountry($fieldName){ $this->wholeForm .='<div class="col2"> <select name="'.$fieldName.'" id="'.$fieldName.'"> <option value="NZ" selected>New Zealand</option> <option value="AF">Afghanistan</option> </select>'; } An input field thats values are being picked up by the php mailer function makeInput($fieldName, $validation, $type){ $this->wholeForm .= '<div class="col2"><input class="input" type = "'.$type.'" name="'.$fieldName.'" id="'.$fieldName.'" onblur="'.$validation.'(this.value,\''.$fieldName.'\') " value="'.$this->valuesArray[$fieldName].'"/></div>'."\n"; } the php mailer code // message - registrant details $message = 'Domain Name: '. $form->clean['domainName']. "\r\n" ; $message .= '<br />Term:'. $form->clean['term']. "\r\n" ; $message .= '<p>REGISTRANT DETAILS '; $message .= '<br />Registrant Name: '. $form->clean['registrantName']. "\r\n" ; $message .= '<br />Address 1: '. $form->clean['address1']. "\r\n" ; $message .= '<br />Address 2: '. $form->clean['address2']. "\r\n" ; $message .= '<br />City: '. $form->clean['city']. "\r\n" ; $message .= '<br />Post Code: '. $form->clean['postcode']. "\r\n" ; $message .= '<br />Province: '. $form->clean['province']. "\r\n" ; $message .= '<br />Country: '. $form->clean['country']. "\r\n" ; $message .= '<br />Phone: '. $form->clean['phone']. "\r\n" ; $message .= '<br />Fax: '. $form->clean['fax']. "\r\n" ; $message .= '<br />Email: '. $form->clean['email']. "\r\n" ; $mail = new PHPMailer(); $body = $mail->getFile('contact.php'); $body = eregi_replace("[\]",'',$message); $subject = eregi_replace("[\]",'',$subject); $mail->From = $form->clean['email']; $mail->FromName = "__________"; $mail->Subject = "Enquiry"; $mail->MsgHTML($message); //email address it is being sent to $mail->AddAddress("[email protected]", "_______"); As well as the drop down select, values from a radio check box are also not being picked up Any suggestions? Link to comment https://forums.phpfreaks.com/topic/189393-php-mailer-not-picking-up-drop-down-select-value/ Share on other sites More sharing options...
mapleleaf Posted January 22, 2010 Share Posted January 22, 2010 Where are you setting the $fieldname variables? And when you view the source are they set? Link to comment https://forums.phpfreaks.com/topic/189393-php-mailer-not-picking-up-drop-down-select-value/#findComment-999735 Share on other sites More sharing options...
emilysnothere Posted January 22, 2010 Author Share Posted January 22, 2010 Hey this is where $fieldName is being set $selectArray = array ('6 Months'=>'6 Months', '1 Year'=>'1 Year', '2 Years'=>'2 Years', '5 Years'=>'5 Years', '10 Years'=>'10 Years'); #### WRITE THE FORM #### $form->openForm('domainForm', '', 'post', 'text'); //registrant $form->makeInputRow('domainName', 'checkEmpty','Domain Name', 'text'); // drop down example $form->makeSelectRow('terms', 'checkEmpty','Term',$selectArray); $form->createHeading('Registrant Details'); $form->makeInputRow('registrantName', 'checkEmpty','Registrant Name', 'text'); $form->makeInputRow('address1', 'checkEmpty','Address 1', 'text'); $form->makeInputRow('address2', '','Address 2', 'text'); $form->makeInputRow('city', 'checkEmpty','City', 'text'); $form->makeInputRow('postcode', '','Post Code', 'text'); $form->makeInputRow('province', '','Province', 'text'); //drop down example two $form->makeCountryRow('country', '', 'Country', ''); $form->submitButton('Submit'); $form->closeForm(); ?> and heres the source code i receive <form class="form" name="domainForm" action="" method="post" enctype="text"> <label for="domainName" class="col1" >Domain Name : </label> <div class="col2"><input class="input" type = "text" name="domainName" id="domainName" onblur="checkEmpty(this.value,'domainName') " value=""/></div> <div id="domainName_msg" class="col3">*</div><div class="clear"></div> <label for="terms" class="col1" >Term : </label> <div class="col2"><select name="terms" id="terms" checkEmpty> <option value="6 Months">6 Months</option> <option value="1 Year">1 Year</option> <option value="2 Years">2 Years</option> <option value="5 Years">5 Years</option> <option value="10 Years">10 Years</option> </select></div><div id="terms_msg" class="col3"></div><div class="clear"></div> <span class="formHeading">Registrant Details</span><div class="clear"></div><label for="registrantName" class="col1" >Registrant Name : </label> <div class="col2"><input class="input" type = "text" name="registrantName" id="registrantName" onblur="checkEmpty(this.value,'registrantName') " value=""/></div> <div id="registrantName_msg" class="col3">* The person or company that this domain will be registered to</div><div class="clear"></div> <label for="address1" class="col1" >Address 1 : </label> <div class="col2"><input class="input" type = "text" name="address1" id="address1" onblur="checkEmpty(this.value,'address1') " value=""/></div> <div id="address1_msg" class="col3">*</div><div class="clear"></div> <label for="address2" class="col1" >Address 2 : </label> <div class="col2"><input class="input" type = "text" name="address2" id="address2" onblur="(this.value,'address2') " value=""/></div> <div id="address2_msg" class="col3"></div><div class="clear"></div> <label for="city" class="col1" >City : </label> <div class="col2"><input class="input" type = "text" name="city" id="city" onblur="checkEmpty(this.value,'city') " value=""/></div> <div id="city_msg" class="col3">*</div><div class="clear"></div> <label for="postcode" class="col1" >Post Code : </label> <div class="col2"><input class="input" type = "text" name="postcode" id="postcode" onblur="(this.value,'postcode') " value=""/></div> <div id="postcode_msg" class="col3"></div><div class="clear"></div> <label for="province" class="col1" >Province : </label> <div class="col2"><input class="input" type = "text" name="province" id="province" onblur="(this.value,'province') " value=""/></div> <div id="province_msg" class="col3"></div><div class="clear"></div> <label for="country" class="col1" >Country : </label> <div class="col2"> <select name="country" id="country"> <option value="NZ" selected>New Zealand</option> <option value="AF">Afghanistan</option> </select> <div class="clear"></div><input type = "submit" name="submit" value="Submit" class="submitButton" /><div class="clear"></div></form> Link to comment https://forums.phpfreaks.com/topic/189393-php-mailer-not-picking-up-drop-down-select-value/#findComment-1000200 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.