HTML / PHP Email Form: Submit button doesn't respond -
i'm working on quote submission form company, , running issue form functionality (namely, submit button nothing). currently, form below:
<form action="quotethanks.php" form id="contact-form"> <fieldset> <p> <label class="name"> <input type="text" name="first" value="first name:*"> <span class="errors"><span class="error">*this not valid name.</span> <span class="empty">*this field required.</span></span></label> <label class="name"> <input type="text" name="last" value="last name:*"> <span class="errors"><span class="error">*this not valid name.</span> <span class="empty">*this field required.</span></span></label> <label class="name"> <input type="text" name="business" value="business name:*"> <span class="errors"><span class="error">*this not valid name.</span> <span class="empty">*this field required.</span></span></label> <label class="email"> <input type="text" name="email" value="e-mail address:*"> <span class="errors"><span class="error">*this not valid email.</span> <span class="empty">*this field required.</span></span></label> <label class="phone"> <input type="text" name="phone" value="phone number:*"> <span class="errors"><span class="error">*this not valid phone number.</span> <span class="empty">*this field required.</span></span></label> <label class="message"> type of quote: * <select name="type"> <option value="display case">display case</option> <option value="case part"> case part</option> <option value="service"> service</option> <option value="other"> other</option> </select></label> <br><br>if "other," please define: <textarea name="define" id="define"></textarea> <br><br> <label class="name"> <input type="text" name="model" value="equipment model number (if known)"> </label> <label class="name"> <input type="text" name="serial" value="equipment serial number (if known)"> </label> quote description: <textarea name="description" id="description"></textarea> <br><br> <label class="name"> <input type="text" name="offer" value="offer code (if applicable)"> </label> <div class="clear"></div> <div class="btns"> <a class="button" data-type="submit">submit</a> <a class="button" data-type="reset">clear</a> <div class="clear"></div> </p> </p> </fieldset> </form>
this should send entered data quote_mailer.php, , redirect quotethanks.php (the last line of code):
<?php /*subject , email variables */ $emailsubject = 'quote request submitted'; $webmaster = 'lmiller@rsiclimate.com'; /* gathering data variables */ $firstfield = $_post['first']; $lastfield = $_post['last']; $businessfield = $_post['business']; $emailfield = $_post['email']; $phonefield = $_post['phone']; $typefield = $_post['type']; $definefield = $_post['define']; $modelfield = $_post['model']; $serialfield = $_post['serial']; $descriptionfield = $_post['description']; $offerfield = $_post['offer']; $body = "<br><hr><br>"; $body.= "name: ".$firstfield." ".$lastfield." <br>"; $body.= "business name: ".$businessfield." <br>"; $body.= "email: ".$emailfield." <br>"; $body.= "phone number: ".$phonefield." <br>"; $body.= "quote type: ".$typefield." <br>"; $body.= "if other, define: ".$definefield." <br>"; $body.= "model number, if known: ".$modelfield." <br>"; $body.= "serial number, if known: ".$serialfield." <br>"; $body.= "quote description: ".$descriptionfield." <br>"; $body.= "offer code: ".$offerfield." <br>"; $headers = "from: ".$emailfield."\r\n"; $headers .= "content-type: text/html\r\n"; if(mail($webmaster, $emailsubject, $body, $headers)) header('location: contact-form-thank-you.html'); ?>
the issue i'm running on form's actual page, data gets entered, , submit button nothing. shows up, can click it, visible purposes nothing happens. while i've worked html more little, creating php-driven forms relatively new me i'm not seeing in code issue might be.
any direction appreciated!
you need use input submit , not anchor, change this
<a class="button" data-type="submit">submit</a>
to
<input class="button" type="submit" name="submit">submit</a>
in php code add instead checking isset()
of button
if(isset($_post['submit'])) { $emailsubject = 'quote request submitted'; $webmaster = 'lmiller@rsiclimate.com'; //all code here } else { //print form }
Comments
Post a Comment