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;
?>
Related
I'm currently making a website using PHP, HTML and a classless CSS (Water.css) Right now, I have a problem aligning my search bars and buttons into a row
<!-- Search Bar Name-->
<form action="search.php" method="GET">
<input type="text" name="query" placeholder="Search Equipment">
<input type="submit" value="Go">
</form>
<!-- Search Bar Price-->
<form action="searchprice.php" method="post">
<label for="min_price">Minimum price:</label>
<input type="text" name="min_price" id="min_price">
<label for="max_price">Maximum price:</label>
<input type="text" name="max_price" id="max_price">
<input type="submit" name="submit" value="Search">
</form>
<button onclick="window.location='add_equipment.php'">Add Equipment</a></button>
The search bars and the button work perfectly fine, however I have no clue why it stacks up like a column instead of being in a row.
It would be nice if someone could help me with this, I am a newbie to HTML
Not sure if this is what you are looking for:
Like Amir said lots of information on using divs,flex,grid in css. I feel like the classless link is making your inputs do that everytime I link to it, it puts everything in columns.
<!DOCTYPE html>
<html>
<head>
<title>Equipments</title>
<meta charset="utf-8">
<link rel="stylesheet" a href="./css/main.css">
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css#2/out/water.min.css"> -->
</head>
<body>
<div class="nav">
<h2>List Of Equipments</h2>
<div class="navs">
<!-- Search Bar Name-->
<form action="search.php" method="GET">
<label for="Search">Search Equipment</label>
<input type="text" name="query" placeholder="Search Equipment"><br>
<input id="Sbutton" type="submit" value="Go">
</form>
</div>
<!-- Search Bar Price-->
<div class="navs">
<form action="searchprice.php" method="post">
<label for="min_price">Minimum price:</label>
<input type="text" name="min_price" id="min_price"><br>
<label for="max_price">Maximum price:</label>
<input type="text" name="max_price" id="max_price"><br>
<input id="Sbutton2" type="submit" name="submit" value="Search">
<button id="Sbutton3" onclick="window.location='add_equipment.php'">Add Equipment</button>
</form>
</div>
</div>
</body>
</html>
Here is the CSS when I am styling I like to change background of each div class so I can get a visual of what is happening as I change code.
.nav{
display: flex;
flex-direction: column;
margin: 10px;
margin-left: 15%;
margin-right: 15%;
padding-bottom: 20px;
background-color: rgb(77, 76, 76);
}
h2{
text-align: center;
font-size: 24px;
font-weight:bolder;
}
.navs {
width: 50%;
background-color: rgb(108, 109, 109);
height: 150px;
text-align: center;
margin-left: 25%;
margin-top: 20px;
padding-top: 10px;
}
#Sbutton{
font-size: 16px;
height: 150%;
width: 15%;
margin-left: 15%;
margin-top: 10px;
}
#Sbutton2{
font-size: 16px;
height: 150%;
width: 15%;
margin-left: 15%;
margin-top: 10px;
}
#Sbutton3{
font-size: 16px;
height: 150%;
width: 25%;
margin-top: 10px;
}
table{
border:3px solid gray;
border-collapse: collapse;
}
th{
border: 2px solid gray;
padding: 6px;
}
td{
border: 2px solid gray;
text-align: center;
}
Hope this helps.
Please have a look at the image and the code below. I am making simple signup html form. I am trying to keep in middle of the screen. also I just want to make div background opacity 50% but somehow, text input's and button's opacity is also changed to 50%.
Please help me to find a solution.
Here's a code of a simple signup form.
<!DOCTYPE html>
<html>
<head>
<title>Sign Up</title>
</head>
<body background="back.jpg">
<form>
<div style="background-color: rgb(255,255,255); opacity: 0.5; display: inline-table; padding: 20px; border-radius: 25px;">
<input type="email" name="email" placeholder="Enter your E-Mail here" style="border-radius: 25px; padding: 5px; outline-style: none;"><br><br>
<input type="password" name="password" placeholder="Enter Password" style="border-radius: 25px; padding: 5px; outline-style: none;"><br>
<p style="color: rgb(58,58,58);"><input type="checkbox" name="tnc"> Accept T&C</p>
<input type="submit" name="submit" value="Sign Up" onclick="submit" style="border-radius: 25px; padding: 5px; width: 150px; outline-style: none;">
</div>
</form>
</body>
</html>
See Output of the code above
Please explain or answer deeply. Thanks in advance
just use this color code for the div if you want to make its opacity 50% only<div style="background-color: rgb(255,255,255,.5); opacity: 0.5; display: inline-table; padding: 20px; border-radius: 25px;">and then you dont have to use the opacity for the div.
first give some width to your formform{width:600px;margin:auto; display:block; }it will makes your form in center.
to give margin from top and bottom give style like thisform{margin:150px auto;} so it will also give margin from top-bottom.
Try this your code will be run
<!DOCTYPE html>
<html>
<head>
<title>Sign Up</title>
</head>
<body background="back.jpg">
<form>
<div style="background-color: rgba(255,255,255, .5); display: table; padding: 20px; border-radius: 25px; margin: 0px auto; text-align: center; top: 50%; left:50%; position: absolute; transform: translate(-50%, -50%)">
<input type="email" name="email" placeholder="Enter your E-Mail here" style="border-radius: 25px; padding: 5px; outline-style: none; background: #fff;"><br><br>
<input type="password" name="password" placeholder="Enter Password" style="border-radius: 25px; padding: 5px; outline-style: none;"><br>
<p style="color: rgb(58,58,58);"><input type="checkbox" name="tnc"> Accept T&C</p>
<input type="submit" name="submit" value="Sign Up" onclick="submit" style="border-radius: 25px; padding: 5px; width: 150px; outline-style: none;">
</div>
</form>
</body>
</html>
show code bellow:
body {
text-align: center;
}
form {
display: inline-block;
}
<html>
<head>
<title>Sign Up</title>
</head>
<body background="back.jpg">
<form>
<div style="background-color: rgb(255,255,255,0.5);display: inline-table; padding: 20px; border-radius: 25px;">
<input type="email" name="email" placeholder="Enter your E-Mail here" style="border-radius: 25px; padding: 5px; outline-style: none;"><br><br>
<input type="password" name="password" placeholder="Enter Password" style="border-radius: 25px; padding: 5px; outline-style: none;"><br>
<p style="color: rgb(58,58,58);"><input type="checkbox" name="tnc"> Accept T&C</p>
<input type="submit" name="submit" value="Sign Up" onclick="submit" style="border-radius: 25px; padding: 5px; width: 150px; outline-style: none;">
</div>
</form>
</body>
</html>
I have prepared a snippet for you, using the display: table(-X) properties:
<!DOCTYPE html>
<html>
<head>
<title>Sign Up</title>
</head>
<body background="back.jpg">
<div style="display:table; height:calc(100vh - 50px); width:100%;"><!-- Change the "-50px" part to whatever size your navbar is -->
<div style="display:table-row;">
<div style="display: table-cell; vertical-align:middle; text-align:center;">
<form style="margin:auto;">
<div style="background-color: rgb(255,255,255); opacity: 0.5; padding: 20px; border-radius: 25px;">
<input type="email" name="email" placeholder="Enter your E-Mail here" style="border-radius: 25px; padding: 5px; outline-style: none;"><br><br>
<input type="password" name="password" placeholder="Enter Password" style="border-radius: 25px; padding: 5px; outline-style: none;"><br>
<p style="color: rgb(58,58,58);"><input type="checkbox" name="tnc"> Accept T&C</p>
<input type="submit" name="submit" value="Sign Up" onclick="submit" style="border-radius: 25px; padding: 5px; width: 150px; outline-style: none;">
</div>
</form>
</div>
</div>
</div>
</body>
</html>
Hope this helps!
I wanna have 3 clickable icons in textbox
can someone support me with this
I found this code for a single clickable icon
I tried more icons in it but is not working
#form1 div {
position: relative;
width: 400px;
padding: 5px;
border: 1px solid #000;
overflow: hidden
}
#form1 label {
float: left;
text-align: right;
width: 80px;
padding: 0 20px;
}
#form1 input {
width: 200px;
padding: 5px 40px 5px 5px;
float: left;
}
#form1 a {
float: left;
margin: 2px 0 0 -32px;
text-decoration: none;
width: 30px;
height: 25px;
background: transparant;
position: relative;
z-index: 99;
}
<form id="form1" method="post" action="">
<div>
<label for="text">Enter text:</label>
<input type="text" name="text" id="text" />
<a href="http://www.pmob.co.uk"><img src="/user/icos/6.gif" border="none">
</a>
</div>
</form>
How about this???
sample screenshot
<form id="form1" method="post" action="">
<div>
<label for="text">Enter text:</label>
<input type="text" name="text" id="text" />
<a href="http://www.url.com"><img src="/folder/img/name.png" height="20" width="20">
</a>
</div>
<input type="submit" value="submit"/>
</form>
You can expand from here, take a look at the picture.... if thats what you want
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;
}
I have set when user types something in the search box, the suggestions will appear.
When suggestions appear, it will push the buttons and texts below down as I set its position relative.
But when user delete those words in the search box and the suggestion list disappears, the buttons and texts below the suggestion list did not move back to the original place.
How can I let the buttons and texts below the suggestion list move back to the original place when user delete those words in search box?
This is my current code:
<?php
include 'script_suggestion.php';
include 'script_close_suggestion_box.php';
?>
<html>
<head>
<title>
Brandon's Search Engine
</title>
<style type="text/css">
#suggestion {
border: 1px solid black;
visibility: hidden;
position: relative;
background-color: transparent;
z-index: 10;
}
.suggestion a {
font-size: 12pt;
color: black;
text-decoration: none;
display: block;
width: 648px;
height: auto;
text-align: left;
padding: 10px;
}
.suggestion a:hover {
background-color: #dddddd;
width: 644px;
padding: 2px;
}
</style>
</head>
<body>
<form method="GET" action="search.php" name="q">
<table align="center">
<div>
<h1><center>Brandon's Search Engine</center></h1>
</div>
<div align="center">
<input type="text" name="q" id="q" class="q" style="height: 27px; width: 650px; padding: 2px" placeholder="Search Now"
onkeyup="getSuggestion(this.value)" autocomplete="off" autoFill="on" onblur="closeBox()"/>
<script>document.getElementById('q').focus()</script>
<div id="suggestionBox" style="visibility: collapse;">
<div id="suggestion" style="width: 645px; text-align: left; padding: 2px;">
</div>
</div>
</div>
<br />
<div align="center">
<input type="submit" value="Search" name="submit" style="height: auto; width: 60px; padding: 2px" />
<input type="reset" value="Clear" onclick="closeBox()" style="height: auto; width: 50px; padding: 2px" />
</div>
<div align="center">
Can't find your site? <br /> Insert here.
</div>
</table>
<input type="hidden" name="page" value="1" />
</form>
</body>
</html>
Thanks in advance.
On your function in your onkeyup, you can check the text value and if that was empty change css position of your element to original:
function getSuggestion(value){
if(!value.length()){
//change to original place
}
.
.
.
}
I hope to help