I was hoping someone can point me in the right direction. I'm looking to have a form in my mobile version of my site that will take either the zip code or city and state plus a radius around that location and display the number of locations of a particular business.
<form id="mobileMapper" action="mapresults.php" method="post">
<div data-role="fieldcontain" class="ui-hide-label formContainer">
<label for="ziCity">City & State, or Zip:</label>
<input type="text" name="zipCity" id="zipCity" value="" placeholder="ex: Chicago, IL or 60602" />
</div>
<div data-role="fieldcontain">
<fieldset class="ui-grid-a">
<div class="ui-block-a">
<label for="radius">Radius:</label>
<select name="radius" id="radius">
<option value="5">5 miles</option>
<option value="10">10 miles</option>
<option value="20">20 miles</option>
</select>
</div>
<div class="ui-block-b"><button type="submit" data-theme="b">Submit</button></div>
</fieldset>
</div>
</form>
Thanks
You can use the Google Places library.
Related
Below is my HTML and PHP code. I'm trying to display my the inputted data, however, I'm getting nothing. What is wrong with my code?
HTML
<form action="welcome.php" method="POST">
<fieldset>
<legend> Personal Details: </legend>
<label for="fname>"></label>
<input type="text" name="Name" id="fname" required autofocus placeholder="First Name" pattern="[a-zA-Z]{3,}" title="Please enter more than three letters">
<label for="lname>"></label>
<input type="text" name="Last Name" id="lname" required autofocus placeholder="Last Name" pattern="[a-zA-Z]{3,}" title="Please enter more than three letters">
<label for="email">Email: </label>
<input type="text" name="email" id="email" required placeholder="Your school email" pattern="[a-zA-Z]{3,}#[a-zA-Z]{3,}[.]{1}[a-zA-Z{2} title="Please enter a valid email address>
<label for="phone">Phone: </label>
<input type="tel" name="phone" id="phone" required placeholder="Please enter in your phone number" pattern="[0-9]{4} [0-9]{3} [0-9]{3}" title="Please enter in a phone number in this format: #### ### ###">
<select name="country" required>
<option value=""> </option>
<option value="US">US</option>
<option value="UK">UK</option>
<option value="AUS">AUS</option>
</select>
</fieldset>
<br>
<fieldset>
<legend> Booking Details: </legend>
<input type="date" name="date" min="2018-10-07" max="2018-10-31">
<input type=time min=9:00 max=17:00 step=900>
<br>
<br>
<label for="dorm">Dormitory: </label>
<br>
<select name="dorm" required>Dormitory
<option value="Cypress">Cypress Hall</option>
</select>
<br>
<br>
<label for="floor">Floor: </label>
<br>
<select name="floor" required>Floor:
<option value=""></option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
</select>
<br>
<br>
<label for="roomnumber">Room Number: </label>
<br>
<select name="roomnumber">Room Number:
<option value=""></option>
<option value="22">22</option>
</select>
<br>
<br>
<label for="roomletter">Room Letter: </label>
<br>
<select name="roomletter" required="">Room Letter
<option value=""></option>
<option value="A">A</option>
<option value="B"> B</option>
</select>
<br>
<br>
<label for="bedroomcleaning">Bedroom: </label><br>
<input type="checkbox" id="box-4" onclick="checkPrice()" value="4">Dust all ceiling fans/light/fixtures within reach.<br>
<input type="checkbox" id="box-5" onclick="checkPrice()" value="5"> Change sheets and/or fold clothes if requested by client.<br>
<input type="checkbox" id="box-6" onclick="checkPrice()" value="6"> Straighten up, put toys away, make beds, fold clothes and put on bed. Straighten papers and put in a pile. DO NOT THROW AWAY ANY PERSONAL ITEMS!<br><br>
<label for="bathroomcleaning">Bathroom: </label><br>
<input type="checkbox" id="box-1" onclick="checkPrice()" value="1"> Clean bowl and wipe down toilet cover, seat, under seat, base and behind the base.<br>
<input type="checkbox" id="box-2" onclick="checkPrice()" value="2"> Clean all mirrors.<br>
<input type="checkbox" id="box-3" onclick="checkPrice()" value="3"> Clean countertops and backsplashes.<br>
<label for="bathroomprice" id="price">Total Price: </label>
<br>
<br>
<input type="submit">
</fieldset>
</form>
PHP
Welcome <?php echo $_POST["Name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
Your phone number is: <?php echo $_POST["phone"]; ?>
Check your pattern for the email input:
[a-zA-Z]{3,}#[a-zA-Z]{3,}[.]{1}[a-zA-Z{2}
[a-zA-Z]{3,}#[a-zA-Z]{3,}[.]{1}[a-zA-Z]{2}
Also:
<input type=time min=9:00 max=17:00 step=900>
<input type="time" min="9:00" max="17:00" step="900">
As said by Jon in the comments, you need a <form> div.
<form action="yourPhpPage.php" method="POST">
<label ...>...</label>
<input ... />
...
<input type="submit" value="Send" />
</form>
The action attribute tells which page to call when submitting form.
The method tells how to send data (GET or POST mainly)
The <input type="submit" /> is the submit button. When you click it the page indicated in action will be called with the values of the different inputs. The value of the submit input is what is shown on it.
Eventually you can use a submit <button> :
<button type="submit">What you want to be displayed on it.</button>
I prefer this one because it's easier to modify its style and behavior respectively with CSS and JS. But it's not the point.
Hope it helps you !Jean-Marc.
hello every one i am newbie i try to create a website i used this function move_uploaded_file its worke with some probleme like french caracter not supported but its move the file from my computer to the destination then i changed some code in php.ini to solve the problem then i uninstall the wamp server and reinstall it again no this function does to resolve the problem i simplyfied the code but still not working
if(isset($_POST['ajouter'])){
$file= $_FILES['cour']['name'];
$file_loc= $_FILES['cour']['tmp_name'];
$file_size = $_FILES['cour']['size'];
$file_type = $_FILES['cour']['type'];
$fichier = 'cours_pdf/';
move_uploaded_file($file_loc,$fichier.$file);
$q = $db->prepare("INSERT INTO tbl_uploads (file,type,size,categorie)
VALUES(:file,:file_type,:file_size,'defau')");
$q->bindValue(':file',$file);
$q->bindValue(':file_type',$file_type);
$q->bindValue(':file_size',$file_size);
$q->execute();
}
and the html code
<div id="forms" style="max-width:350px;" >
<form class="form-horizontal" action="up.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label class="btn btn-success btn-file">Browse
<input type="file" name="cour" hidden>
</label>
</div>
<div class="form-group" >
<label for="categorie">choisir la categorie ou enregistrer votre cours</label>
<select class="form-control" name="categorie" required>
<option value="cardiologie">cardiologie</option>
<option value="chirurgie_general">chirurgie_general</option>
<option value="chirurgie_thoracique">chirurgie_thoracique</option>
<option value="dermatologie">dermatologie</option>
<option value="endocrinologie">endocrinologie</option>
<option value="gynecologie">gynecologie</option>
<option value="hematologie">hematologie</option>
<option value="infectiologie">infectiologie</option>
<option value="neurologie">neurologie</option>
<option value="orl">orl</option>
<option value="pediatrie">pediatrie</option>
<option value="urologie">urologie</option>
<option value="gastro_enterologie">gastro_enterologie</option>
<option value="psychiatrie">psychiatrie</option>
</select>
</div>
<input type="submit" class="btn btn-warning" name="ajouter" value="envoyer">
</form>
</div>
please help me iam siack here and forgive my weak english thanks
The field for inputting file is hidden, remove hidden from your input.
<label class="btn btn-success btn-file">
Browse <input type="file" name="cour"> <!-- removed hiddedn -->
</label>
I have built a html form in which a user has to specify which product he likes to order and depending on his answer other input fields arise. I have used some javascript for that. But now i want to data the user enters to be passed on to email via php. I know very little of php and scripting in general (let's say about nothing) but i did find some tutorials and templates on it. The only thing is that they all seem slightly different and specific to a form (mostly contact forms). And if i follow them closely it works fine, it's just that when i want to customize a little i seem to get terribly lost.
I have posted this before (Can i post data from a select drop down to email using PHP?) and have gotten some answers. It's just that i didn't formulate my initial problem well enough and edited it afterwards, but i don't know if that's the way to go on this forum. So i posted a new question (sorry if that's overkill, i'm pretty new to all of this). This is my html:
<form method="post" name="contact_form" action="contact.php">
<div class="form-div1">
<label for="profile" class="label1">Select your profile</label>
<br>
<select id="user-type" class="selectlist">
<option value="option1">I'm a first-time user</option>
<option value="option2">I would like to renew or upgrade</option>
</select>
</div>
<div class="form-div2">
<label for="SEN" class="label2">SEN</label>
<br>
<input type "text" name="input1" class="input1">
</div>
<div class="form-div3">
<label for="email" class="label3">Email Address</label>
<br>
<input type "text" name="input2" class="input2">
</div>
<div class="form-div4">
<label for="product_choice" class="label4" name="select_menu">Select your product</label>
<br>
<select id="product" class="selectlist">
<option value="option1">JIRA</option>
<option value="option2">Confluence</option>
<option value="option3">JIRA Service Desk</option>
<option value="option4">Stash</option>
<option value="option5">Other</option>
</select>
</div>
<div class="form-div42">
<label for="product" class="label42">Specify your product</label>
<br>
<input type "text" name="input2" class="input2">
</div>
<div class="form-div5">
<label for="license_choice" class="label5">Select your license</label>
<br>
<select id="select" class="selectlist">
<option value="option1">25 users</option>
<option value="option2">50 users</option>
<option value="option3">100 users</option>
</select>
</div>
<div class="input_box_atlassian">
<input type="submit" name="submit" value="Submit" class="submit-button-atl" />
</div>
</form>
Now i want to build working php so i can pass the data to an email. Can somebody point me in the right direction or preferably show me some tutorials that tackle this issue more closely.
I havent dont any validation, try client side & server side validation along with code
Change the HTML as below
<form method="post" name="contact_form" action="contact.php">
<div class="form-div1">
<label for="profile" class="label1">Select your profile</label>
<br>
<select id="user_type" name="user_type" class="selectlist">
<option value="I'm a first-time user">I'm a first-time user</option>
<option value="I would like to renew or upgrade">I would like to renew or upgrade</option>
</select>
</div>
<div class="form-div2">
<label for="SEN" class="label2">SEN</label>
<br>
<input type "text" name="SEN" class="SEN">
</div>
<div class="form-div3">
<label for="email" class="label3">Email Address</label>
<br>
<input type "text" name="email" class="email">
</div>
<div class="form-div4">
<label for="product_choice" class="label4" name="select_menu">Select your product</label>
<br>
<select id="product" name="product" class="selectlist">
<option value="JIRA">JIRA</option>
<option value="Confluence">Confluence</option>
<option value="JIRA Service Desk">JIRA Service Desk</option>
<option value="Stash">Stash</option>
<option value="Other">Other</option>
</select>
</div>
<div class="form-div42">
<label for="product" class="label42">Specify your product</label>
<br>
<input type "text" name="product_specify" id="product_specify" class="input2">
</div>
<div class="form-div5">
<label for="license_choice" class="label5">Select your license</label>
<br>
<select id="license_choice" name="license_choice" class="selectlist">
<option value="25">25 users</option>
<option value="50">50 users</option>
<option value="100">100 users</option>
</select>
</div>
<div class="input_box_atlassian">
<input type="submit" name="submit" value="Submit" class="submit-button-atl" />
</div>
</form>
And make another PHP file by the name contact.php & paste the below code.
<?php
if($_REQUEST['submit']=='Submit'){
$user_type=$_REQUEST['user_type'];
$sen=$_REQUEST['SEN'];
$email=$_REQUEST['email'];
$product=$_REQUEST['product'];
$product_specify=$_REQUEST['product_specify'];
$license_choice=$_REQUEST['license_choice'];
$to = 'nobody#example.com'; //to whom the email have to besnd
$message = "User Type: $user_type \n Sen: $sen \n Email: $email \n Product: $product \n Product Specified: $product_specify \n License: $license_choice"; //content of the email
$subject = 'hello'; //shown as subject of the email
$headers = 'From: webmaster#example.com' . "\r\n" . //eamil header information
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers)){
echo "Mail Sucessfully Sent";
} else {
echo "Something went wrong";
}
}
?>
This will get the content from the form HTML & email its contents, however only if the email server is configured correctly
Consider the following URL http://www.freecontactform.com/email_form.php
Cheers!!
I am totally new in PHP, in fact the reason I am doing this is to customize a wordpress plugin so it can fit my need. So far I have a default form, what I am doing now is to add a country dropdown. Here's how I add it
<div class="control-group">
<label class="control-label" for="Country">Country :</label>
<div class="controls">
<select id="itemType_id" name="cscf[country]" class="input-xlarge">
<option value="malaysia#email.com">Malaysia</option>
<option value="indonesia#email.com">Indonesia</option>
</select>
<span class="help-inline"></span>
</div>
</div>
So far I only able to retrieve the value of selected item with
$cscf['country'];
How can I get the display text which is the country name in this case ?
You can use a hidden field, and with JavaScript and jQuery you can set the value to this field, when the selected value of your dropdown changes.
<select id="itemType_id" name="cscf[country]" class="input-xlarge">
<option value="malaysia#email.com">Malaysia</option>
<option value="indonesia#email.com">Indonesia</option>
</select>
<input type="hidden" name="country" id="country_hidden">
<script>
$(document).ready(function() {
$("#itemType_id").change(function(){
$("#country_hidden").val(("#itemType_id").find(":selected").text());
});
});
</script>
Then when your page is submitted, you can get the name of the country by using
$_POST["country"]
<select name="text selection" onchange="getText(this)">
<option value="">Select text</option>
<option value="1">my text 1</option>
<option value="2">my text 2</option>
</select>
First put a java script function on the attribute "onchange" of the select.
Then, create your function that will transfer the text in a text box by using getElementById
<script>
function getText(element) {
var textHolder = element.options[element.selectedIndex].text
document.getElementById("txt_holder").value = textHolder;
}
</script>
Then create a temporary holder:
<input type="" name="txt_holder" id="txt_holder"> type should be hidden
Then assign it in a PHP variable:
$variableName=$_POST['txt_holder'];
Try this
<?php
if(isset($_POST['save']))
{
$arrayemail = $_POST['cscf'];
$mail = $arrayemail['country'];
$explode=explode('#',$mail);
// print_r($explode);
if(isset($explode[0]))
echo ucfirst($explode[0]);
}
?>
<form method="post">
<div class="controls">
<select id="itemType_id" name="cscf[country]" class="input-xlarge">
<option value="malaysia#email.com">Malaysia</option>
<option value="indonesia#email.com">Indonesia</option>
</select>
<span class="help-inline"></span>
</div>
<div class="controls">
<input type="submit" name='save' value="Save"/>
<span class="help-inline"></span>
</div>
</form>
Try it like,
<?php
if(isset($_POST['save']))
{
//Let $_POST['cscf']['country']= malaysia#email.com
// you can explode by # and get the 0 index name of country
$cnt=explode('#',$_POST['cscf']['country']);
if(isset($cnt[0]))// check if name exists in email
echo ucfirst($cnt[0]);// will echo Malaysia
}
?>
<form method="post">
<div class="controls">
<select id="itemType_id" name="cscf[country]" class="input-xlarge">
<option value="malaysia#email.com">Malaysia</option>
<option value="indonesia#email.com">Indonesia</option>
</select>
<span class="help-inline"></span>
</div>
<div class="controls">
<input type="submit" name='save' value="Save"/>
<span class="help-inline"></span>
</div>
</form>
Rather inputing one by one for a class/lessen for a day, I'd like to input 10 forms at once.
The HTML is something like this.
All the form do the same thing, add start_time, finish_time and instructor in a database.
However I am not sure how to do this. And I am not sure if this HTML is correct or not.
Any inputs will be appreciated.
Thanks in advance.
HTML
<?php
$date = "2010-10-08";
?>
<form name="form1" method="post" action="inputform.php">
<!-- form 1 -->
<label for='start_time'>1. Start Time</label>
<input type="text" name="start_time" />
<label for='finish_time'>Finish Time</label>
<input type="text" name="finish_time" />
<label for='instructor'>Instructor</label>
<select name="instructor">
<option value="john">John</option>
<option value="mary">Mary</option>
<option value="jim">Jim</option>
</select>
<input type="hidden" name="date" value="<?php echo $date; ?>"/>
<div style="clear: both;"> </div>
<!-- form 2 -->
<label for='start_time'>2. Start Time</label>
<input type="text" name="start_time" />
<label for='finish_time'>Finish Time</label>
<input type="text" name="finish_time" />
<label for='instructor'>Instructor</label>
<select name="instructor">
<option value="john">John</option>
<option value="mary">Mary</option>
<option value="jim">Jim</option>
</select>
<input type="hidden" name="date" value="<?php echo $date; ?>"/>
<div style="clear: both;"> </div>
<!-- form 3 -->
<label for='start_time'>3. Start Time</label>
<input type="text" name="start_time" />
<label for='finish_time'>Finish Time</label>
<input type="text" name="finish_time" />
<label for='instructor'>Instructor</label>
<select name="instructor">
<option value="john">John</option>
<option value="mary">Mary</option>
<option value="jim">Jim</option>
</select>
<input type="hidden" name="date" value="<?php echo $date; ?>"/>
<div style="clear: both;"> </div>
<!-- form 4,5,6,7,8,9,10 -->
<input type="submit" name="submit" value="Submit" />
</form>
you cannot submit multiple forms at once.
only one form with the form specific method/action.
however what probably need are arrays.
you can do something like
<form ...>
<select name="instructor[]">
...
</select>
<select name="instructor[]">
...
</select>
then you will get an array posted which you can loop through.
just look at the structure by printing out $_POST like print_r($_POST); then you'll see