$_POST fields not forwarding to the verify.php script reCAPTCHA - php

I've got a form with CSS styling. When I leave the CSS styling in place the reCAPTCHA widget does not send the "recaptcha_challenge_field" and "recaptcha_response_field" in the $_POST data. They are causing my $resp to always evaluate to false.
I've found that if I remove the id="contactform" attribute that the reCAPTCHA works properly.
Here's my form code:
<form action="PHP/contact2.php" method="post" id="contactform">
<ol>
<li>
<label for="name">Name <span class="red">*</span></label>
<input id="name" name="name" class="text" />
</li>
<li>
<label for="email">email <span class="red">*</span></label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="company">Company</label>
<input id="company" name="company" class="text" />
</li>
<li>
<label for="subject">Subject</label>
<input id="subject" name="subject" class="text" />
</li>
<li>
<label for="message">Message <span class="red">*</span></label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<?php
require_once("PHP/recaptchalib.php");
$publickey = "Public key is here, I've removed it for security";
echo recaptcha_get_html($publickey);
?>
<li class="buttons">
<input type="image" name="imageField" id="imageField" src="images/send.gif" class="send" />
<div class="clr"></div>
</li>
</ol>
</form>
My CSS styling is here:
/********** contact form **********/
#contactform { margin:0; padding:5px 10px;}
#contactform * {
color:#000;
}
#contactform ol { margin:0; padding:0; list-style:none;}
#contactform li { margin:0; padding:0; background:none; border:none; display:block; clear:both;}
#contactform li.buttons { margin:5px 0 5px 0;}
#contactform label {
margin:0;
width:110px;
display:block;
padding:10px 0;
color:#605f5f;
font: normal 12px Arial, Helvetica, sans-serif;
text-transform:capitalize;
float:left;
}
#listform label {
margin:0;
width:110px;
display:block;
padding:10px 0;
color:#605f5f;
font: normal 12px Arial, Helvetica, sans-serif;
text-transform:capitalize;
float:left;
}
#contactform label span { color:#F00;}
#contactform input.text { width:200px; border:1px solid #e8e8e8; margin:10px 0; padding:5px 2px; height:16px; background:#fff; float:left;}
#contactform dropdown {
width:200px;
border:1px solid #e8e8e8;
margin:10px 0;
padding:5px 2px;
height:16px;
background:#fff;
float:left;
Q-RFL; AMPS;
}
#contactform textarea { width:410px; border:1px solid #e8e8e8; margin:10px 0; padding:2px; background:#fff; float:left;}
#contactform li.buttons input { padding:3px 0 3px 110px; margin:0; border:0; color:#FFF; float:left;}
My server side php to handle the form is cookie cutter from the quickstart guide. I've only added a simple if statement to check if the reCAPTCHA fields are being passed.
This is the response I get from the server side:
The reCAPTCHA wasn't entered correctly. Go back and try it again.(reCAPTCHA said: incorrect-captcha-sol)
but the reCAPTCHA was entered correctly.
Any Suggestions?

You should add a submit button on the form and passed that value using $_POST.
To pass the fields value to verify.php, you should do this
<form ....>
.........
.........
<input type=submit id=x name=x value=Submit>
</form>
In php,put like this
if(isset($_POST['x']) && $_POST['message']!="" ......){
$value1=$_POST['message'];
$value2=$_POST['subject'];
......................
}

Related

Checkbox alignment issues within PHP/HTML form

I am trying to edit a form I have used many times but now I need to add checkboxes for options and I cannot for the life of me get them to align correctly or figure out where the formatting needs to be changed. I am not an expert at PHP, HTML, or CSS I was just tasked with this being in IT so I am learning as I am going. You guys have always came to my rescue on previous projects too and I am about a days worth deep into it with no changes. Made the checkboxes red in the CSS just so I could make sure a change I made to them went.
Basically want the checkboxes to look like this:
Project needs: [] Photography [] Videography [] Resize
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Marketing and Communications Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="marketing_style.css" />
</head>
<body>
<center>
<br /><br /><img src="logo.jpg" width="350px" height"100px"><br /><br />
<H1>Marketing and Communications Request</H1>
</center>
<div id="page-wrap">
<div id="contact-area">
<br />
<br />
<form method="post" action="marketing_contactengine.php">
<label for="Name">Name:</label>
<input type="text" name="Name" id="Name" />
<label for="Email">Email:</label>
<input type="text" name="Email" id="Email" />
<label for="Phone">Phone:</label>
<input type="text" name="Phone" id="Phone" />
<label for="Dept">Department:</label>
<input type="text" name="Dept" id="Dept" />
<label for="Dir">Department Director:</label>
<input type="text" name="Dir" id="Dir" />
<label for="COID">COID/Account Code (GL Code):</label>
<input type="text" name="COID" id="COID" />
<br><br>
<br><br>
<h2><u>EVENT INFORMATION</u></h2>
<label for="EventName">Event Name:</label>
<input type="text" name="EventName" id="EventName" />
<label for="EventDateTime">Event Date & Time:</label>
<input type="text" name="EventDateTime" id="EventDateTime" placeholder="01/01/2021 08:00:00" />
<label for="EventLocation">Event Location:</label>
<input type="text" name="EventLocation" id="EventLocation" />
<label for="Desc">Brief description of the event:</label><br />
<textarea name="Desc" rows="2" cols="10" id="Desc"></textarea>
<br><br>
<br><br>
<h2><u>PROJECT INFORMATION</u></h2>
<label for="ProjectName">Project Name:</label>
<input type="text" name="ProjectName" id="ProjectName" />
<label for="Materials">Materials due date:</label>
<input type="text" name="Materials" id="Materials" />
<br />
</div>
<div id="checkboxes" class="checkboxes">
<label id="ProjectNeeds" for="ProjectNeeds" class="checkboxes">Project needs (check all that apply):</label>
<label class="checkboxes" for="Photography"><input type="checkbox" id="Photography" /> <span>Photography</span></label>
<label class="checkboxes" for="Videography"><input type="checkbox" id="Videography" /> <span>Videography</span></label>
<label class="checkboxes" for="Resize"><input type="checkbox" id="Resize" /> <span>Resize</span></label>
</div>
</div>
</div>
<div id="bottom" style="position: relative;">
<div style="position: absolute;">
Submission of this form is required for all requests to the marketing and communications team.
</div>
</body>
</html>
CSS:
body {
font-size: 62.5%;
font-family: Helvetica, sans-serif;
}
p {
font-size: 1.3em;
margin-bottom: 15px;
}
#page-wrap {
background: white;
padding: 20px 50px 20px 50px;
min-height: 500px;
height: auto !important;
height: 500px;
width: 700px;
}
#contact-area {
width: 660px;
margin-top: 25px;
}
#contact-area input, #contact-area textarea {
padding: 10px;
width: 471px;
font-family: Helvetica, sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
/* border: 2px solid #ccc; */
}
/* #contact-area textarea { */
/* height: 90px; */
/* } */
#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #900;
}
#contact-area input.submit-button {
width: 100px;
float: right;
}
label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 10px;
font-size: 1.4em;
font-weight: bold;
}
#bottom {
font-family: Helvetica, sans-serif;
font-size: 1.4em;
margin: 0px 0px 0px 100px;
width: 900px;
padding-top: 75px;
padding-bottom: 75px;
text-align: left;
}
#checkboxes {
color: red;
}
In your CSS, you have a label {} declaration that is affecting all labels, including the ones next to your input radios. It is making them float and that's why they mess up.
To fix it you need to add another declaration that cancels the float for the labels inside #checkboxes, like so:
#checkboxes label {
float: none;
}
You have to set the label CSS properties like that:
label {
float: left;
text-align: right;
margin-right: 15px;
padding-top: 10px;
font-size: 1.4em;
font-weight: bold;
}
And add another CSS line:
.checkboxes input { float:left; vertical-align:middle; margin-right:10px; }

Trouble Aligning Columns in Form

I'm creating an online form and having a bit of trouble aligning the input boxes in the form. I've tried <br>, but it's always slightly off. I'm assuming this is affecting the text below as well.
Also, is PHPMailer still the preferred(simplest) way to go to retrieve the data user's input and attach? Some files might be pretty large.
head,
body {
font-family: 'Open Sans', sans-serif;
margin: 0;
padding: 0;
}
.header {
background-color: #0C2440;
color: white;
padding-top: 10px;
padding-bottom: 15px;
padding-right: 5px;
}
.header img {
float: left;
padding-top: 10px;
padding-right: 10px;
}
.header h1 {
text-align: center;
margin-right: 110px;
}
h2 {
text-align: center;
}
input[type=text],
select {
width: 80%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=date],
select {
width: 80%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=button] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=button]:hover {
background-color: #45a049;
}
.column {
width: 50%;
float: left;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Mileage Certification Change Request Form</title>
<link rel="stylesheet" href="stylesheet.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700,800" media="all" onload="if(media!='all')media='all'">
<script src="jquery-3.4.1.min.js"></script>
<script type="text/javascript">
document.getElementById('date').value = Date();
// document.getElementById('submit').onclick = function () {
// location.href = "confirmation.html";
// return false;
// };
// document.querySelectorAll('a[href^="#"]').forEach(anchor => {
// anchor.addEventListener('click', function (e) {
// e.preventDefault();
// document.querySelector(this.getAttribute('href')).scrollIntoView({
// behavior: 'smooth'
// });
// });
// });
</script>
</head>
<body>
<div class="header">
<img src="logo.png" alt="Logo">
<h1>Planning Department</h1>
</div>
<br>
<h2>Mileage Change Request Form</h2>
<br>
<div class="form">
<form>
<fieldset>
<br>
<div class="column">
Date of Submittal:<br>
<input type="date" id="date" name="date"><br> County Name:<br>
<input type="text" id="county" name="county"><br> City/Town Name:<br>
<input type="text" id="cityname" name="cityname"><br> Name of Office and Title:<br>
<input type="text" id="officename" name="officename"><br> Address:
<br>
<input type="text" id="address" name="address"><br> City:
<br>
<input type="text" id="city" name="city"><br>
</div>
<div class="column">
State:<br>
<input type="text" id="state" name="address"><br> ZIP Code:<br>
<input type="text" id="zip" name="zip"><br> Telephone:
<br>
<input type="text" id="phone" name="phone"><br> Fax:
<br>
<input type="text" id="fax" name="fax"><br> Email:
<br>
<input type="text" id="email" name="email"><br> Comments:
<br>
<input type="text" id="comments" name="comments"><br>
</div>
<div class="reqs">
<br>
<p><b>Before we can make any changes, you MUST include items 1-3 for each submission. For annexations with mileage changes, you MUST include items 1-4. If you only have an annexation with no changes to mileage, item 4 is all you need to submit.</b></p>
<ol>
<li>Copy of a current (scaled) map(s) depicting the roads that need added and/or removed OR a shapefile or file geodatabase. If none of these are available, provide a copy of measurable (Scaled) plats depicting the roads that need added/removed.</li>
<input type="file" id="uploaded_file" name="pic" accept="image/*" required>
<li>Copy of meeting minutes at which a governing body accepted the roads into your system. If unavailable, please provide a letter stating the acceptance of the roads signed by an elected official. An example acceptance letter is available if
needed.</li> <input type="file" name="pic" accept="image/*" required>
<li>A list of each road and its requested mileage.</li> <input id="fileSelect" name="spreadsheet" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" required>
<li>Copy of annexation ordinance(s) establishing the new corporate limits along with a shapefile and/or file geodatabase of the correct corporate limits. If a shapefile is not available provide a drawing of the correct corporate limits on a scaled
map.</li> <input type="file" name="pic" accept="image/*" required>
</ol>
</div>
</fieldset>
</form>
</div>
<input id="submit" type="button" value="Submit"></input>
<!-- <?php
if(isset($_POST['submit'])) {
$emailAddress = '';
require "class.phpmailer.php";
$msg = 'Date:'.$_POST['date'].'<br /> County:'.$_POST['county'].'<br /> City/Town Name:'.$_POST['cityname'].'<br /> Name of Office and Title: '.$_POST['officename']. '<br /> Address: '.$_POST['address']. '<br /> City: '.POST['city'], '<br /> State: $_POST['state']. '<br /> ZIP Code: '.POST['zip']. '<br /> Telephone: '.$_POST['phone']. '<br /> Fax: '.$_POST['fax']. '<br /> Email: '.$_POST['email']. '<br /> Comments: '$_POST['comments']. '<br />';
move_uploaded_file($_FILES["uploaded_file"]["tmp_name"], $_FILES["uploaded_file"]["name"]);
$mail = new PHPMailer();
$mail->IsMail();
$mail->AddReplyTo($_POST['email'], $_POST['name']);
$mail->AddAddress($emailAddress);
$mail->SetFrom($_POST['email'], $_POST['name']);
$mail->Subject = "Subject";
$mail->MsgHTML($msg);
$mail->AddAttachment( $_FILES["uploaded_file"]["name"]);
$mail->Send();
echo'<script> window.location="../MCCR.html"; </script> ';
}
?> -->
</body>
</html>
Remove <br> and use CSS style. Added some style in your existing code as
// newly added style begin
h2 {
text-align: center;
margin:30px 0;
}
fieldset {
padding-top:20px;
}
.form-fields {
display: flex;
flex-direction:row;
width: 80%;
margin: 0 auto;
}
.column {
width:50%;
display:flex;
flex-direction:column;
}
input {
width:100%;
}
//end
head,
body {
font-family: 'Open Sans', sans-serif;
margin: 0;
padding: 0;
}
.header {
background-color: #0C2440;
color: white;
padding-top: 10px;
padding-bottom: 15px;
padding-right: 5px;
}
.header img {
float: left;
padding-top: 10px;
padding-right: 10px;
}
.header h1 {
text-align: center;
margin-right: 110px;
}
input[type=text],
select {
width: 80%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=date],
select {
width: 80%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=button] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=button]:hover {
background-color: #45a049;
}
// newly added style begin
h2 {
text-align: center;
margin:30px 0;
}
fieldset {
padding-top:20px;
}
.form-fields {
display: flex;
flex-direction:row;
width: 80%;
margin: 0 auto;
}
.column {
width:50%;
display:flex;
flex-direction:column;
}
input {
width:100%;
}
//end
<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Mileage Certification Change Request Form</title>
<link rel="stylesheet" href="stylesheet.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700,800" media="all" onload="if(media!='all')media='all'">
<script src="jquery-3.4.1.min.js"></script>
<script type="text/javascript">
//document.getElementById('date').value = Date();
// document.getElementById('submit').onclick = function () {
// location.href = "confirmation.html";
// return false;
// };
// document.querySelectorAll('a[href^="#"]').forEach(anchor => {
// anchor.addEventListener('click', function (e) {
// e.preventDefault();
// document.querySelector(this.getAttribute('href')).scrollIntoView({
// behavior: 'smooth'
// });
// });
// });
</script>
</head>
<body>
<div class="header">
<img src="logo.png" alt="Logo">
<h1>Planning Department</h1>
</div>
<h2>Mileage Change Request Form</h2>
<div class="form">
<form>
<fieldset>
<div class="form-fields">
<div class="column">
Date of Submittal:
<input type="date" id="date" name="date"> County Name:
<input type="text" id="county" name="county"> City/Town Name:
<input type="text" id="cityname" name="cityname"> Name of Office and Title:
<input type="text" id="officename" name="officename"> Address:
<input type="text" id="address" name="address"> City:
<input type="text" id="city" name="city">
</div>
<div class="column">
State:
<input type="text" id="state" name="address"> ZIP Code:
<input type="text" id="zip" name="zip"> Telephone:
<input type="text" id="phone" name="phone"> Fax:
<input type="text" id="fax" name="fax"> Email:
<input type="text" id="email" name="email"> Comments:
<input type="text" id="comments" name="comments">
</div>
</div>
<div class="reqs">
<p><b>Before we can make any changes, you MUST include items 1-3 for each submission. For annexations with mileage changes, you MUST include items 1-4. If you only have an annexation with no changes to mileage, item 4 is all you need to submit.</b></p>
<ol>
<li>Copy of a current (scaled) map(s) depicting the roads that need added and/or removed OR a shapefile or file geodatabase. If none of these are available, provide a copy of measurable (Scaled) plats depicting the roads that need added/removed.</li>
<input type="file" id="uploaded_file" name="pic" accept="image/*" required>
<li>Copy of meeting minutes at which a governing body accepted the roads into your system. If unavailable, please provide a letter stating the acceptance of the roads signed by an elected official. An example acceptance letter is available if
needed.</li> <input type="file" name="pic" accept="image/*" required>
<li>A list of each road and its requested mileage.</li> <input id="fileSelect" name="spreadsheet" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" required>
<li>Copy of annexation ordinance(s) establishing the new corporate limits along with a shapefile and/or file geodatabase of the correct corporate limits. If a shapefile is not available provide a drawing of the correct corporate limits on a scaled
map.</li> <input type="file" name="pic" accept="image/*" required>
</ol>
</div>
</fieldset>
</form>
</div>
<input id="submit" type="button" value="Submit"></input>
<!-- <?php
if(isset($_POST['submit'])) {
$emailAddress = '';
require "class.phpmailer.php";
$msg = 'Date:'.$_POST['date'].'<br /> County:'.$_POST['county'].'<br /> City/Town Name:'.$_POST['cityname'].'<br /> Name of Office and Title: '.$_POST['officename']. '<br /> Address: '.$_POST['address']. '<br /> City: '.POST['city'], '<br /> State: $_POST['state']. '<br /> ZIP Code: '.POST['zip']. '<br /> Telephone: '.$_POST['phone']. '<br /> Fax: '.$_POST['fax']. '<br /> Email: '.$_POST['email']. '<br /> Comments: '$_POST['comments']. '<br />';
move_uploaded_file($_FILES["uploaded_file"]["tmp_name"], $_FILES["uploaded_file"]["name"]);
$mail = new PHPMailer();
$mail->IsMail();
$mail->AddReplyTo($_POST['email'], $_POST['name']);
$mail->AddAddress($emailAddress);
$mail->SetFrom($_POST['email'], $_POST['name']);
$mail->Subject = "Subject";
$mail->MsgHTML($msg);
$mail->AddAttachment( $_FILES["uploaded_file"]["name"]);
$mail->Send();
echo'<script> window.location="../MCCR.html"; </script> ';
}
?> -->
</body>
</html>

Input fields looks different after form submit (Wordpress)

I have a form which is styled with css. The form is submitted to the same page. When I post the form, the text input fields look different - the padding on top and bottom seems to be gone (not the left and right padding though).
However, when I inspect the code, the css values are the same. Except for the text input fields, everything looks as it should.
The code of the form:
<div class="form mtop20">
<form action="" method="post" name="myform" id="signup_form">
<div>
<input type="text" name="fname" class="textinput" placeholder="Förnamn" maxlength="30" >
<input type="text" name="lname" class="textinput" placeholder="Efternamn" maxlength="30" >
<input type="text" name="email" class="textinput" placeholder="Emailadress" maxlength="50">
<p class="font_form_text"><input type="text" name="lineage_nr" placeholder="Ättnummer" maxlength="10" class="sm_textinput" ></p>
<p class="font_form_text mtop20">Jag vill ha utskick via brev: <span class="fright padr10 valign_b"><label for="brev_ja">Ja </label><input type="radio" id="brev_ja" class="valign_m" name="brevutskick" value="Ja" checked="checked"><label for="brev_nej" class="padl5">Nej </label> <input type="radio" id="brev_nej" name="brevutskick" value="Nej" ></span></p>
<p class="font_form_text mtop20">Jag representerar mig själv: <span class="fright padr10 valign_b"> <label for="lineage_y">Ja </label><input type="radio" id="lineage_y" class="valign_m" name="own_lineage" value="Ja"><label for="lineage_n"class="padl5">Nej </label> <input type="radio" id="lineage_n" name="own_lineage" value="Nej"></span></p>
<div id="hidden_lineage_form">
<p class="font_form_text mtop20 padb7">Fullmakt behövs:</p>
<input type="text" name="lineage_name" class="textinput" placeholder="Ättenamn" maxlength="40">
<input type="text" name="pers_nr" placeholder="Personnummer" class="sm_textinput" maxlength="11">
</div><br>
<?php wp_nonce_field( 'signup', 'signup_nonce' ); ?>
<input type="submit" class="submit mtop20 fright padr10" name="submit_msg" value="Skicka">
</div>
</form>
When the page is loaded initially, the text input fields have these values (and it looks as it should):
.sm_textinput, .textinput {
height: 25px;
margin-bottom: 5px;
background: #fdfef5;
border: 1px solid #e7e5de;
font-family: 'PT Sans', sans-serif;
font-size: 14px;
padding: 5px 0 4px 8px;
display: block;
When the form is submitted, the page reloads, and then the css looks like this (identical):
.sm_textinput, .textinput {
height: 25px;
margin-bottom: 5px;
background: #fdfef5;
border: 1px solid #e7e5de;
font-family: 'PT Sans', sans-serif;
font-size: 14px;
padding: 5px 0 4px 8px;
display: block;
}
..but as I said, the text input fields are not of the same height! When I check the new height in Photoshop, it is 23px.
The original value of the height is 25px plus 9px (top and bottom padding).
By the way, I use a separate css file for this page , which I have registered in "functions.php". I placed it beneath the wp_register_style for styles.css :
wp_register_style('style_extra', get_template_directory_uri() . '/css/style_extra.css', array(), '1.1', 'all');
wp_enqueue_style('style_extra'); // Enqueue it!
It is a strange problem, and I am hoping you can find the solution.
Try this one
.sm_textinput, .textinput {
height: 25px !important;
margin-bottom: 5px;
background: #fdfef5;
border: 1px solid #e7e5de;
font-family: 'PT Sans', sans-serif;
font-size: 14px;
padding: 5px 0 4px 8px !important;
display: block;
}

Contact form in HTML CSS but I do not create PHP code

I created the contact form in html and css now comes the hard part.
Since it is my first experience with the php code sapede tell me how to create the code so that you can send the mail with all the information on the form?
Sorry for my bad English, Let me know if you didn't understand my Question
The HTML code
<form id="contactform">
<div class="formcolumn">
<label for="name">Nome e Cognome</label>
<input type="text" id="name" />
<label for="indirizzo">Indirizzo</label>
<input type="text" id="indirizzo" />
<ul>
<li>Consegna a Domicilio<input type="checkbox" id="domicilio" /></li>
</ul>
</div>
<div class="formcolumn">
<label for="telefono">Telefono</label>
<input type="text" id="telefono" />
<label for="email">E-mail</label>
<input type="email" id="email" />
<ul>
<li>Ritiro presso la macelleria<input type="checkbox" id="macelleria" /></li>
</ul>
</div>
<div class="formcolumn_2">
<label for="consegna">Indirizzo di consegna</label>
<input type="text" id="consegna" />
<label for="note">Note</label>
<input type="text" id="note" />
<label for="feedback">Ordine</label>
<textarea id="feedback"></textarea>
</div>
<div class="buttons">
<input class="button" value="INVIA" type="INVIA">
</div>
</form>
The CSS code
#contactform{
font-family:"Eras Medium ITC";
width: 585px;
border: 1px solid blue;
}
.formcolumn input, #contactform textarea{
width:95%;
border: 2px solid orange;
padding: 4px;
}
.formcolumn_2 input, #contactform textarea{
width:571px;
border: 2px solid orange;
padding: 4px;
}
#contactform textarea{
resize:vertical;
height: 200px;
}
#contactform input[type="checkbox"]{
width: auto;
float:right;
height: auto;
margin-left: 15px;
margin-bottom: 25px;
}
#contactform .formcolumn{
width:280px;
float: left;
}
#contactform .formcolumn:first-of-type{
margin-right: 25px;
}
#contactform label {
padding-top:10px;
padding-bottom:5px;
display: block;
}
#contactform ul{
list-style:none;
list-type: none;
margin: 0;
padding: 0;
float: left;
}
#contactform ul li{
float: left;
width: auto;
margin-top:20px;
}
#contactform div.buttons{
clear: both;
text-align: center;
}
#contactform input.button{
margin-top: 1.5EM;
width: 50%;
box-shadow: 0 0 10px gray;
text-transform: uppercase;
cursor: pointer;
min-width: 100px;
max-width: 600px;color: white;
font-weight: bold;
letter-spacing: 7px;
text-shadow: 0 -2px 1px #8a8a8a;
background: rgb(169,3,41);
background: -moz-linear-gradient(top, rgba(169,3,41,1) 0%,
rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%);
background: -webkit-gradient(linear, left top, left bottom,
color-stop(0%,rgba(169,3,41,1)), color-stop(44%,rgba(143,2,34,1)),
color-stop(100%,rgba(109,0,25,1)));
background: -webkit-linear-gradient(top, rgba(169,3,41,1)
0%,rgba(143,2,34,1) 44%,rgba(109,0,25,1) 100%);
background: -o-linear-gradient(top, rgba(169,3,41,1)
0%,rgba(143,2,34,1) 44%,rgba(109,0,25,1) 100%);
background: -ms-linear-gradient(top, rgba(169,3,41,1)
0%,rgba(143,2,34,1) 44%,rgba(109,0,25,1) 100%);
background: linear-gradient(to bottom, rgba(169,3,41,1)
0%,rgba(143,2,34,1) 44%,rgba(109,0,25,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#a90329', endColorstr='#6d0019',GradientType=0 );
}
#contactform input.button:active{
text-shadow: 0 0 1px #8a8a8a;
background: rgb(109,0,25);
background: -moz-linear-gradient(top, rgba(109,0,25,1) 0%,
rgba(143,2,34,1) 56%, rgba(169,3,41,1) 100%);
background: -webkit-gradient(linear, left top, left bottom,
color-stop(0%,rgba(109,0,25,1)), color-stop(56%,rgba(143,2,34,1)),
color-stop(100%,rgba(169,3,41,1)));
background: -webkit-linear-gradient(top, rgba(109,0,25,1)
0%,rgba(143,2,34,1) 56%,rgba(169,3,41,1) 100%);
background: -o-linear-gradient(top, rgba(109,0,25,1)
0%,rgba(143,2,34,1) 56%,rgba(169,3,41,1) 100%);
background: -ms-linear-gradient(top, rgba(109,0,25,1)
0%,rgba(143,2,34,1) 56%,rgba(169,3,41,1) 100%);
background: linear-gradient(to bottom, rgba(109,0,25,1)
0%,rgba(143,2,34,1) 56%,rgba(169,3,41,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#6d0019', endColorstr='#a90329',GradientType=0 );
}
Also can you tell me because even though I gave text-align: center INVIO button on the message remains on the left?
you need something like this
<html><body>
<form action= "post.php" method= "POST">
<p>Имя: </p><p> <input type= "text" name= "name"> </p>
<p>E-mail: </p><p> <input type= "text" name= "email"></p>
<p>Сообщение: </p><p> <textarea rows= "10" cols= "45" name= "message"></textarea></p>
<input type= "submit" value= "Отправить">
</body></html>
where action= "post.php" php file is a connection, so you need to explicitly write this file to send letters and then connect it as in Example
just copy and paste..hope this will help you!
<?php
if(isset($_POST['subm']))
{
$name=$_POST['name'];
$Indirizzo=$_POST['Indirizzo'];
$telefono=$_POST['telefono'];
$email=$_POST['email'];
$consegna=$_POST['consegna'];
$note=$_POST['note'];
$feedback=$_POST['feedback'];
$to = "somebody#example.com";
$subject = "Details";
$message = "
<html>
<head>
<title>Contact details</title>
</head>
<body>
<p>Your Details</p>
<table>
<tr>
<th>Name</th>
<th>Indirizzo</th>
<th>telefono</th>
<th>email</th>
<th>consegna</th>
<th>note</th>
<th>feedback</th>
</tr>
<tr>
<td>$name</td>
<td>$Indirizzo</td>
<td>$telefono</td>
<td>$email</td>
<td>$consegna</td>
<td>$note</td>
<td>$feedback</td>
</tr>
</table>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: somebody#example.com>' . "\r\n";
$headers .= 'Cc: somebody#example.com' . "\r\n";
mail($to,$subject,$message,$headers);
echo "Thank you for sending us feedback";
}
?>
<html>
<head>
</head>
<title>feedback form</title>
<style>
<---your css code -->
</style>
</head>
<body>
<form id="contactform" method="post">
<div class="formcolumn">
<label for="name">Nome e Cognome</label>
<input type="text" id="name" name="name" />
<label for="indirizzo">Indirizzo</label>
<input type="text" id="indirizzo" name="Indirizzo" />
<ul>
<li>Consegna a Domicilio<input type="checkbox" id="domicilio" /></li>
</ul>
</div>
<div class="formcolumn">
<label for="telefono">Telefono</label>
<input type="text" id="telefono" name="telefono" />
<label for="email">E-mail</label>
<input type="email" id="email" name="email" />
<ul>
<li>Ritiro presso la macelleria<input type="checkbox" id="macelleria" /></li>
</ul>
</div>
<div class="formcolumn_2">
<label for="consegna">Indirizzo di consegna</label>
<input type="text" id="consegna" name="consegna"/>
<label for="note">Note</label>
<input type="text" id="note" name="note"/>
<label for="feedback">Ordine</label>
<textarea id="feedback" name="feedback"></textarea>
</div>
<div class="buttons">
<input class="button" value="INVIA" name="subm" type="submit">
</div>
</form>
</body>
</html>

I have a contact form that on the css styles that fit mobile devices it won't let me input data

So I can fill out the form on the desktop size but when I got to fill it out on mobile sizes (640, 480, and 320) it doesn't let me. I found out something by trying things and just happen to have my cursor outside my contactform div that has the form inside it. Then it let me type in everything but the message box unless I use tab and am still outside the div. I find it odd?
benlevywebdesign.com
The bottom of the page is where the form is for you to test out the mobile layouts for 640, 480, and 320.
Here is the contact form
<form id="form1" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<fieldset>
<p class="form">
<label for="name">Name</label>
<input type="text" name="name" id="name" size="30" />
</p>
<p class="form">
<label for="email">Email</label>
<input type="text" name="email" id="email" size="30" />
</p>
<p class="form">
<label for="web">Website</label>
<input type="text" name="web" id="web" size="30" />
</p>
</fieldset>
<fieldset>
<p class="form">
<label for="message">Message</label>
<textarea name="message" id="message" cols="30" rows="10"></textarea>
</p>
</fieldset>
<p class="submit"><button name="submit" type="submit">Send</button></p>
</form>
Here is my css style for 480 and 320
#media screen and (max-width:480px){
#media screen and (max-width:320px){
#form1{
padding-top:5px;
}
#form1 fieldset{
margin:0;
padding:0;
border:none;
float:left;
display:inline;
width:190px;
margin-left:15px;
}
#form1 legend{display:none;}
#form1 p{margin:.5em 0;}
#form1 label{display:block;}
#form1 input, #form1 textarea{
width:175px;
border:1px solid #B7B7B7;
background:#fff;
padding:3px;
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #EEEEEE), to(#FFFFFF));
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px);
}
#form1 textarea{
height:120px;
width:175px;
overflow:auto;
}
#form1 p.submit{
clear:both;
padding:0 25px 5px 25px;
margin:0;
text-align:right;
}
#form1 button{
font-family:Trebuchet MS;
font-size:14px;
width:105px;
height:35px;
border:none;
background-color:#484749;
color:#fff;
border-radius:4px;
cursor:pointer;
text-align:center;
}
Have you tried resizing your browser and viewing your site on a PC (I'm using FF), it goes all kinds of screwy. Also Firebug says you have 15 errors and 10 warnings - might be worth trying to fix these first before going back to mobile devices.
Heres a short video of the issues: http://screencast-o-matic.com/watch/clhwo4GGI

Categories