color.php
<!DOCTYPE html>
<html>
<body style="padding-left:200px">
<form action="" method="post">
<br>
<br>
<div>
<label style="color:orange">Enter Text: </label>
<input type="text" name="size" placeholder="ENTER YOUR TEXT">
</div>
<br>
<br>
<div>
<label style="color:orange">Select Size: </label>
<input type="text" name="size">
</div>
<br>
<br>
<div>
<label class="control-label" style="color:orange">Font Name :</label>
<select name="font" style="margin-left:14px; color:black;">
<option disabled selected value> -- select an option -- </option>
<option>Times New Roman</option>
<option>Arial</option>
<option>Verdana</option>
<option>Georgia</option>
<option>Impact</option>
</select>
</div>
<br>
<br>
<div>
<label style="color:orange">Choose Color: </label>
<input type="text" name="size">
</div>
<br>
<br>
<input type="submit" value="submit">
</form>
</body>
</html>
Hello every one I have a very much simply question on php, I might be downvoted for this but
I am not getting any idea on how to do this, this is what im trying to do I have a field in which if I enter something for example say "I love coding" and after
entering this in the input field and later if I select any font size ,font name and color, then that entered text should be displayed with the particular values
can anyone tel me how do I start this work, im not getting any idea. please it will be helpfull if someone guides me.
it should be purely in php
You can't change html tags with php, I'm not sure but maybe you can do it with javascript
Related
I have set up a website in a way that leaves the user on a confirmation page to submit form data with the GET data present in the URL of the confirmation page (It's nothing sensitive). I'd like it so that upon pushing a button, the GET data on that page's URL is sent to another URL, is this possible?
I could probably just copy and paste the form and set it to be hidden and set the values to the individual values but that isn't what I want to do because it'd create extra work in the future adding more form inputs.
Edit:
Here is the code for the form:
<form action="confirmrequest.php">
<div id="extracontact">
<h4>Please choose a method of contacting you in the event more detail from you is required</h4>
<select name="socialmediatype" required>
<option>-Choose an option below-</option>
<option value="Instagram">Instagram</option>
<option value="Snapchat">Snapchat</option>
<option value="Whatsapp">Whatsapp</option>
<option value="Skype">Skype</option>
</select>
<br>
<br>
Platform Username (or phone for Whatsapp):<br>
<input type="text" name="contactpin" required>
</div>
<br>
<div>
<h4>Please enter your email address to receive confirmation email & download link</h4>
<br>
Email Address<br>
<input type="email" name="email" required>
</div>
<br>
<div>
<h4>Which type of art style are you requesting?</h4>
<input type="radio" name="style" value="Lineart" required> Lineart - $5<br>
<input type="radio" name="style" value="Coloured"> Coloured - $6<br>
<input type="radio" name="style" value="Background & Shading"> Background/Shading - $7<br><br>
</div>
<div>
<h4>Please include a full description of what you would like</h4>
<textarea name="description" cols="50" rows="10"></textarea>
</div>
<br>
<input type="submit" class="btn btn-primary" value="Submit Request">
</form>
hi people i have these two scripts for fill a database table on my PC , with an HTML form . the HTML code works perfect but the php it just does not work , i have specified everything ,but it just doesn't work , when i give click on submit the browser just pop ups a download option but nothing else...
<html>
<head>
<tittle>
<h1 > <b> FORMAT FOR TECHNICAL ISSUES
<link rel="stylesheet" href="/var/www/html/proyecto/css/styles.css">
</b> </h1>
</tittle>
<hr> </hr>
</head>
<body>
<div>
<img src="logo.png" width=100% /img>
<hr> </hr>
<form method="POST" action="">
<input type="text" placeholder="NOMBRE" name="Nombre" maxlenght="30" size="20px" id="nombre" >
<input type="text" name="Extension" placeholder=EXTENSION maxlength="5" id="extension">
<br>
<hr> </hr>
<br>
<br>
<h2> CAMPAIGN /CAMPAÑA </h2>
<br>
<label for="Campaign"> Select your campaign:</label>
<select name="Campaign" id="campaign" >Campaign
<option value="Procall">Procall</option>
<option value="Tigo">Tigo</option>
<option value="Spanish">Spanish</option>
</select>
<hr> </hr>
<h2> KIND OF FAILURE </h2>
<label for="Tipo de incidente">Select the type of incident:</label>
<select id="incident" name="incidente" placeholder="Tipo de incidente">incident
<option value="Slow Computer">Slow Computer</option>
<option value="Headset fail"> Headset Fail </option>
<option value="Zoiper Issue">Zoiper Issue </option>
<option value="Crm Issue">Crm Issue </option>
<option value="Spark Issue">Spark Issue </option>
<option value="Vc Dialer Issue">VC Dialer Issue </option>
<option value="Network Issue">Network Issue </option>
</select>
<input type"text" id="description" name="Description" placeholder=DESCRIPTION style="width:300px;height:100px">
<br></br>
<h2>FAILURE DATE </h2>
<label for="failure date"> Enter the day and hour when failure occurred :</label>
<input name="failure_date" type="date-time-local" placeholder="yyyy/mm/dd/hh/mm" id="failure date" min="2018-05-01T08:30" max="2018-12-30T22:30" >
<br>
<hr></hr>
<label for="did you lose a call?" id="lost_call" >Did you lose any call?:</label>
<br>
<input type="radio" name="lost call" value="yes " id="lost_call" > Yes , i lost a call.
<br>
<input type="radio" name="lost_call" value="no" id="lost_call" >No i have not lost any call
<br
<br>
<label id="lost docmuent" for="did you lose any document?"> Did you lose any document or information?:</label>
<br>
<input type="radio" name="document" value="yes"> Yes i lost one or more documents
<br>
<input type="radio" name="document" value="no"> No have not lost any document.
<br>
<br>
<label for="did you have to log out?" id="logout" > Did you have to logout?:</label>
<br>
<input type="radio" name="logout" value="yes">Yes i had to logout
<br>
<input type="radio" name="logout" value="no">no i didn't have to logout
<br>
<br>
<br>
<br>
<input type="submit">
</form>
</div>
</body>
</html>
and here is the php script for the action and connect to the sql database
<?php
$con = mysql_connect("localhost","root","m0l0t0v" );
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("it", $con);
$sql="INSERT INTO tec-issues (Nombre,Extension ,Campaign ,incidente,Description,failure_date,lost_call,document,logout )
VALUES
('$_POST[Nombre]', '$_POST[Extension]', '$_POST[Campaign]', '$_POST[incidente]', '$_POST[Description]', '$_POST[failure_date]', '$_POST[lost_call]', '$_POST[document]', '$_POST[logout]' )";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
PLEASE HELP ME EVERYTHING IS CORRECT , BUT IT JUST DONT WORK
Check syntax for mysql_select_db it should be mysql_select_db($con,"dbname") and please use mysqli prefix instead of mysql because it is safer.
I recommend using msqli_escape_string for every data you get from POST or GET to protect from sql injection
I am trying to store a timestamp in my database. HTML code:
<form action="insert.php" method="POST"/>
<style>
p{
float:center;
}
</style>
<Font color=red > <center>Support or Analysis Tracker (SoAT) </center></Font>
</br>
</br>
<p align="left">
<label for="PROCESS"><FONT color=default>Analysis/Support</label>  </t>
<select id="PROCESS" name="PROCESS">
<option value="Analysis">Analysis</option>
<option value="Support">Support</option>
</select>
         
<label for="SO_NUMBER"><FONT color=default>SO_Number</label>
<input type="text" id="SO_NUMBER" name="SO_NUMBER" value ="SO_" required/>
         
<label for="PERSON_INCHARGE"><FONT color=default>Person_Incharge</label>
<input type="text" id="PERSON_INCHARGE" name="PERSON_INCHARGE" required/></br>
</br></br>
</br>
</p>
<p align="left">
<label for="DESCRIPTION"><FONT color=default>Description</label>
<input type="text" id="DESCRIPTION" name="DESCRIPTION" />
</p>
</br>
</br>
<div style="text-align:center">
<button>
<img alt="ok" src=
"http://www.blueprintcss.org/blueprint/plugins/buttons/icons/tick.png" />
INSERT
</button>
</fieldset>
</form>
After hitting the insert button, I need to store the current time and date in the database. The backend database structure is as following:
In these cases you can use from now() function of mysql.
Insert INTO tablename(RECEIVED) VALUES(now())
with this structure it use from mysql server date and time
I have the following code for input fields:
echo form_label('Name :', "first_name[0]");
echo form_input("first_name[0]", set_value("first_name[0]"));
echo form_error("first_name[0]");
This outputs the following HTML code:
<label for="first_name[0]"> Name: </label>
<input type="text" name="first_name[0]" value>
This is part of a form that accommodates 2-5 participants. The idea is to have 2 name fields at least active, while the other 3 are disabled by default and you can activate them with a checkbox.
I am not very good with JQuery and am unable to accomplish this.
Is it possible with jquery again, to clear any input if the checkbox is selected to activate the field, and then is unchecked after that?
I'm not sure, but I believe you are looking for something like this (JSFiddle):
<div class="participant">
<label for="first_name[0]"> Name: </label>
<input type="text" name="first_name[0]" value>
</div>
<div class="participant">
<label for="first_name[0]"> Name: </label>
<input type="text" name="first_name[0]" value>
</div>
<div class="participant">
<label for="first_name[0]"> Name: </label>
<input type="text" name="first_name[0]" value>
</div>
<div class="participant">
<label for="first_name[0]"> Name: </label>
<input type="text" name="first_name[0]" value>
</div>
<div class="participant">
<label for="first_name[0]"> Name: </label>
<input type="text" name="first_name[0]" value>
</div>
<button id="add-participant">
Add Another
</button>
js
$(".participant:gt(1)").addClass("hidden");
$("#add-participant").on("click", function() {
$(".participant.hidden").first().removeClass("hidden");
if(!$(".participant.hidden").length) {
$(this).hide();
}
});
Only the first 2 will be visible at first, but you can click the button to add more... up to 5.
Or... something like this would probably be better... starting from just a single participant and creating more if needed... with the ability to remove.
JSFiddle
I have an html form where people can subscribe to a mailing list. The form includes form validation and when the form is submitted, the data is stored in a database using My SQL.
Here is the code on the index.html page where the form is
<form id="subscribe-form" action="send.php" method="post">
<p id="status"></p>
<div>
<label for="title">Title:</label>
<select class="uniform" name="title" id="title">
<option>Please Choose</option>
<option>Mr</option>
<option>Mrs</option>
<option>Miss</option>
<option>Ms</option>
</select>
</div>
<div>
<label for="firstName">First name:</label>
<input type="text" id="firstName" name="firstName" />
</div>
<div>
<label for="surname">Surname:</label>
<input type="text" id="surname" name="surname" />
</div>
<div>
<label for="email">Email:</label>
<input type="text" id="email" name="email" />
</div>
<div>
<label for="phone">Contact Number:</label>
<input type="text" id="phone" name="phone" />
</div>
<div>
<label for="title">How did you hear about us?</label>
<select class="uniform" name="refer" id="refer">
<option>Please Choose</option>
<option>Google</option>
<option>Yahoo</option>
<option>Word of Mouth</option>
<option>Others</option>
</select>
</div>
<div>
<input type="checkbox" name="news_updates" value="1" />
I'd like to hear about the latest news and events updates</div>
<div>
<input class="button" type="submit" value=""/>
</div>
</form>
Here is the code for send.php
<?php
include ('connection.php');
$sql="INSERT INTO form_data (title,firstName, surname, email, phone, refer, news_updates)
VALUES
('$_POST[title]', '$_POST[firstName]','$_POST[surname]','$_POST[email]','$_POST[phone]','$_POST[refer]','$_POST[news_updates]')";
if (!mysql_query($sql, $connected))
{
die('Error: ' . mysql_error());
}
mysql_close($connected);
?>
I would like to make another html (unsubscribe.html) page where people can unsubscribe by entering their email address so that their email address would match the corresponding email that is in the database already and remove it from the My Sql database .
I found this tutorial which was kind of helpful -
http://www.phpsuperblog.com/php/delete-records-from-mysql-database-with-html-form-and-php/
and this is the form on my unsubscribe.html page.
<form id="unsubscribe_form" action="delete.php" method="post">
<div>
<label for="email_remove">Email:</label>
<input type="text" id="email_remove" name="email_remove" />
</div>
<div>
<input name="delete" type="submit" id="delete" value="" class="unsubscribe_btn">
</div>
</form>
but when I enter method="post" in the unsubscribe form. The data from the form on the subscribe / index.html does not get stored in My Sql, instead they come up as blank.
So I am guessing I can't have two "post" method maybe??
If someone could guide me in the right direction that would be much appreciate. Thanks.
I guess you are at your learning stage. So, I will suggest you to have a check for POST method being called on the page which receives the post.
Example: in your subscribe.php
you should have :
<input class = "button" type = "submit" value = "Subscribe" name = "subscribe" />
in send.php
you must do:
if(!isset($_POST['subscribe'])
{
header('location: subscribe.html');
}
You must use isset for your pages.
If you could display your delete.php, perhaps I can edit this post and assist you further but, so far... A check is required and you can use as many forms as many you like (even on one page) but, make sure they all have different id/names.
Your delete.php script should be:
<?php
require ('connection.php'); // User require for important functions so that if not found, it throws fatal error
$email = $_POST['email_remove'];
// Check for isset POST
$query = "DELETE from form_data WHERE email = '".$email."'";
if(mysql_query($query)){ echo "deleted";} else{ echo "fail";}
?>
your delete.php seems OK to me.
Can add the following to Line 2
echo "";
print_r($_POST);
and post array in comments?