Input fields looks different after form submit (Wordpress) - php

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;
}

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; }

Trying to create a submission form with preview

I am trying to make this form be able to submit a post and create a page with auto indexing and also be able to preview the page being created before hand. Can someone help? Thank you in advance, I am pretty bad with PHP files.
#wrapper{
margin: 0 auto;
margin-top: 200px;
padding-left: 50px;
padding-right: 50px;
padding-bottom: 50px;
padding-top: 50px;
background-color: #2C2C2C;
position: relative;
width: 70%;
max-width: 1250px;
min-width: 300px;
z-index: 1;
color: white;
text-decoration-color: white;
box-shadow: 0px 2px 20px 5px #000;
}
.form-control .header {
width: 90%;
outline: inset #6B6B6B;
margin: 5px;
}
<div align="center" id="wrapper">
<h2>Welcome Back <Insert Name>!</h2>
<form id="submission" method="post" action="submission-handler.php" enctype="multipart/form-data">
Blog Title:<center></center>
<br>
Blog Content:<center><textarea name="message" class="form-control" placeholder="Type your blog post here" rows="10" required></textarea>
<textarea name="header" type="text" class="form-control" placeholder="Blog Post Header" rows="2" required></textarea>
</center>
<br>
Upload an image: (Not Currently Working)
<center><input type="file" name="filetoupload" id="filetoupload" disabled></center>
<br>
<br>
<hr>
<br>
<br>
<input type="submit" class="form-control submit" value="Preview Post" disabled>
<input type="submit" class="form-control submit" value="Finalize Post" disabled>
</form>
</div>
The actual page looks different than shown up on here. If anybody needs a reference , here
based on your code above your trying to pass a value to another page..
try to put this code in submission-handler.php
<?php
$message = $_POST['message'];
$header = $_POST['header'];
echo $message;
echo "<br>";
echo $header;
?>

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

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'];
......................
}

Expandable search bar; Implementation and Animation

I'm trying to create an expandable search bar; like www.apple.com uses. (Or I guess previously had up)
I've been trying to work with this code;
http://www.cibgraphics.com/blog/article/create_an_expandable_search_form
I currently have all that code via the tutorial plugged into my test site - and it's not appearing. Can anyone help me figure out why? Test site located at; www.o s m p r o d u c t i o n.com
Also, once I get this implemented; I'd like to figure out how to add the nice transition similar to what apple has in the expandable, rather then the clunky one the code in the above links has. So I guess the sub-question would be; how could I implement a smoother transition to the animation of the search bar becoming larger?
I'm pretty much using exactly what's inside the code of that link; but it's also below.
Mark-Up:
<section>
<form class="search_form">
<input type="search" class="searchinput" placeholder="Search"/>
<input type="submit" value="Search" class="searchsubmit"/>
</form>
<div class="clear"></div>
</section>
CSS:
<!--Styles for Search Bah-->
.clear {
clear: both;
}
.search_form {
background: #fff;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
-o-border-radius: 8px;
-ms-border-radius: 8px;
border-radius: 8px;
border: 1px solid #d6d6d6;
padding: 3px;
padding-left: 8px;
-webkit-box-shadow: inset 0 2px 2px rgba(0,0,0,.3);
-moz-box-shadow: inset 0 2px 2px rgba(0,0,0,.3);
-o-box-shadow: inset 0 2px 2px rgba(0,0,0,.3);
-ms-box-shadow: inset 0 2px 2px rgba(0,0,0,.3);
box-shadow: inset 0 2px 2px rgba(0,0,0,.3);
float: left;
}
.searchsubmit {
display: block;
height: 23px;
width: 23px;
line-height: 29px;
background: url('../images/searchicon.png') no-repeat 3px 4px;
text-indent: -9999px;
border: none;
vertical-align: middle;
float: right;
}
.searchinput {
width: 200px;
font-size: 13px;
color: #999;
background: #fff;
vertical-align: middle;
margin-top: 4px;
border: none;
float: left;
outline: none;
}
.searchinput:focus {
width: 400px;
}
.searchinput {
width: 200px;
font-size: 13px;
color: #999;
background: #fff;
vertical-align: middle;
margin-top: 4px;
border: none;
float: left;
outline: none;
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear;
-ms-transition: all 0.3s linear;
transition: all 0.3s linear;
}
::-webkit-search-decoration
{
display: none;
}
input[type=search]{
-webkit-appearance:textfield;
-webkit-box-sizing:content-box;
}
And I guess lastly; How can I tie the functionality, of a working 'Search form' with my new one I'm currently using? Would a quick way be; somehow tying the 'standard WP search box' with my new one I created? Either customize it to look like my new one, or define my new one with it's functionalities and hide the previous one?
Update: I have the search bar setup basically in my test site at the top right of the screen; but now the 'search button' that I'm calling isn't appearing to the right of it as it should. And I'm stuck with figuring out how to tie the functionality of a standard WP working search form with it.
Here is the PHP mark-up of the standard WP functional Search bar that came with the theme; I think I just need to migrate/integrate the styles and scripts via my new 'Search Bar', but now - how?
<ul>
<!-- <div align="center"> -->
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<!-- <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" size="20" /> -->
<input type="text" value="<?php _e('Search','emerald_stretch'); ?>" name="s" id="s" size="20" onfocus="if (this.value == '<?php _e('Search','emerald_stretch'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search','emerald_stretch'); ?>';}" />
<input type="submit" id="searchsubmit" value="<?php _e('Find','emerald_stretch'); ?>" />
</form>
<!-- </div> -->
</ul>
I just attempted to add the new styles and appearance of the new one I created by adding the classes; and now it appears in place of the old WP one - but on focus it disappears?
<ul>
<!-- <div align="center"> -->
<form method="get" class="search_form" action="<?php bloginfo('home'); ?>/">
<!-- <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" size="20" /> -->
<input type="text" class="searchinput" value="<?php _e('Search','emerald_stretch'); ?>" name="s" id="s" size="20" onfocus="if (this.value == '<?php _e('Search','emerald_stretch'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search','emerald_stretch'); ?>';}" />
<input type="submit" class="searchsubmit" id="searchsubmit" value="<?php _e('Find','emerald_stretch'); ?>" />
</form>
<!-- </div> -->
</ul>
Your search box is working fine by the looks of it. Look at the very bottom left hand corner of your site. If your're trying to get the green search box on the upper right hand corner of your site to reflect this type of animation, then you need to properly reference the CSS you have specified.

Div tag does not contain content

I've created a form that enters comments onto my blog posts but when the comments are displayed on the webpage the background color that I added to the div is either to big or to small. I've provided the code below. Any help is appreciated!
<h2 id="comments-title">Comments</h2>
<div id="comment-list">
<?php
}
$commenttimestamp = strtotime("now");
$sql = "SELECT * FROM php_blog_comments WHERE entry='$id' ORDER BY timestamp";
$result = mysql_query ($sql) or print ("Can't select comments from table php_blog_comments.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$timestamp = date("l F d Y", $row['timestamp']);
printf("<div class='comment-ind'><p id='comments'><a id='username' href=\"%s\">%s</a> %s</p>", stripslashes($row['url']), stripslashes($row['name']), $timestamp);
print("<p class='comments'>" . stripslashes($row['comment']) . "</p><div class='clr'><br></div></div>");
}
?>
<form id="commentform" method="post" action="process.php">
<p><input type="hidden" name="entry" id="entry" value="<?php echo $id; ?>" />
<input type="hidden" name="timestamp" id="timestamp" value="<?php echo $commenttimestamp; ?>">
<input type="text" name="name" id="name" title="Name (required)" /><br />
<input type="text" name="email" id="email" title="Mail (will not be published) (required)" /><br />
<input type="text" name="url" id="url" title="Website" value="http://" /><br />
<br />
<textarea title="Your Comment Goes Here" name="comment" id="comment"></textarea></p>
<p><input type="submit" name="submit_comment" id="submit_comment" value="Add Comment" /></p>
</form>
</div>
CSS:
#comments-title {
background-color: #282828;
width: 567px;
height: 30px;
font-size: 25px;
font-family: arial;
color: #ffffff;
padding: 5px;
padding-top: 6px;
padding-bottom: 4px;
}
#comment-list{
border:1px solid #dadada;
width: 565px;
padding: 5px;
font-family: Helvetica;
font-size: 18px;
}
#comments {
width: 480px;
font-size: 12px;
color: #444444;
}
.comments {
width: 480px;
height: 20px;
}
.comment-ind {
background-color: #eeeeee;
width: 548px;
position: relative;
min-height: 10px;
margin: 5px;
padding: 8px;
}
Image:
Your problem is with height: 20px;. You can change it to min-height: 20px; and then it will be at least that height, but the way you have it, it will always be 20px tall regardless of the content.
Are we seeing the whole css that applies to this div. Looking at the screen shot I would guess that the paragraph of text is floated left and the containing div is not wrapping. Try removing the height and adding overflow:hidden to the containing .comments div. That way the height will adjust with the size of the contain.

Categories