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>
Related
I have an html-form which includes some information to be sent to the php-script. The type of an input of this information is "button". It is important that all the values are saved.
<form name="CoordinatesReceiving" method="get" action="MainScript.php">
<p> Insert the coordinates of the point: </p>
<label> Insert X <input type="button" name="xCoordinate" id="xCoordinate" value="1"> </label> <br>
<label> Insert R <input type="button" name="radius" id="radius" value="5"> </label> <br>
<input type="submit" name="send" value="Send.">
</form>
The form has to "remember" that I pressed these buttons and send them to the server.
How can I implement this?
An example for the x-button:
<label for="xCoordinate">Insert X</label>
<input type="button" name="xCoordinate" id="xCoordinate" onclick="this.value=1">
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
I have been reading extensively about this and cannot seem to find a resolution. I have created a form in PHP which I want to submit to the same page I am on. I have read that there are some name's that wordpresses reserves such as "name" - which I am not using. Does anyone have any idea why this redirects to page not found upon submission?
http://hybridhosting.net/markeim/properties/52-coles-road/
<form action="" method="POST">
<input type="hidden" id="my_favorite_nonce" name="my_favorite_nonce" value="a87e4a44aa"><input type="hidden" name="_wp_http_referer" value="/markeim/properties/52-coles-road/"> <input type="hidden" name="form_title" value="brokercontact">
<input type="hidden" name="brokers" value="testemail#gmail.com">
<p>
Your Name
<span>
*
</span>
<br>
<input type="text" id="yourname" name="yourname" class="ink">
</p>
<p>
Your E-mail
<span>
*
</span>
<br>
<input type="text" id="youremail" name="youremail" class="ink">
</p>
<p>
Your Message
<span>
*
</span>
<br>
<textarea cols="" rows="" id="yourmessage" name="yourmessage" class="lab"></textarea>
</p>
<p>
<input type="submit" class="sending" value="Contact Broker">
</p>
</form>
It's something to do with your hidden input fields, not sure what. When I delete the nodes from dev tools and submit the form, it goes through fine!
Delete the hidden input field with name="brokers" and you'll see
I'm guessing WP uses the term "brokers" for something, please see here:
http://contactform7.com/faq/are-there-any-reserved-or-unavailable-words-for-the-name-of-an-input-field/
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?
Alright here is what I am attempting to do. I have a form written in HTML. It has a few HTML5 elements to it though. What I would like to happen, is when the user fills out all the required fields (validated with PHP and some HTML5) and submits the form, it will export to an existing XML file. The form also uses AJAX to validate as the user fills out the fields, and to validate the form as a whole (once submitted) without reloading my page.
The XML file is just a framework of empty tags set up to receive the information from form submissions, built upon a schema (I made) to restrict it to certain values and what not. I would also need to be able to have a script to validate the new XML values against the schema to make sure all values are valid, and if not return an error message.
The XML Schema validation is as close as possible to the PHP validation with a few character amount limits added in here and there.
If you need me to post the schema for the XML file in order to give a more specific answer then I will upon request.
XML Framework:
<form>
**<!-- First Name -->**
<fname></fname>
<!-- Last Name -->
<lname></lname>
<!-- Phone Number -->
<phone></phone>
<!-- Email -->
<email></email>
<!-- Website -->
<website></website>
<!-- Subject -->
<subject></subject>
<!-- Message -->
<message></message>
</form>
HTML Form:
<form method="post" action="php/validator.php" name="contactform" id="contactform" autocomplete="on">
<fieldset>
<legend>Contact Details</legend>
<div>
<label for="fname" accesskey="F">Your First Name*</label>
<input name="fname" type="text" id="name" placeholder="Enter your first name" tabindex="1" required />
</div>
<div>
<label for="lname" accesskey="L">Your Last Name*</label>
<input name="lname" type="text" id="name" placeholder="Enter your last name" tabindex="2" required />
</div>
<div>
<label for="email" accesskey="E">Email*</label>
<input name="email" type="email" id="email" placeholder="myEmail#example.com" pattern="^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)#([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$" tabindex="3" required />
</div>
<div>
<label for="phone" accesskey="P">Phone <small>(optional)</small></label>
<input name="phone" type="tel" id="phone" size="12" placeholder="555-555-5555" tabindex="4" />
</div>
<div>
<label for="website" accesskey="W">Website <small>(optional)</small></label>
<input name="website" type="url" id="website" placeholder="www.yourWebDomain.com" tabindex="5" />
</div>
</fieldset>
<fieldset>
<legend>Your Comments</legend>
<div>
<label for="subject" accesskey="S">Subject*</label>
<select name="subject" id="subject" tabindex="6" required="required">
<option value=""></option>
<option value="Support">Support</option>
<option value="Sale">Sales</option>
<option value="Bug">Report a bug</option>
<option value="Other">Other</option>
</select>
</div>
<div>
<label for="comments" accesskey="C">Comments*</label>
<textarea name="comments" cols="40" rows="3" id="comments" class="comments" placeholder="Enter your comments" spellcheck="true" required tabindex="7"></textarea>
</div>
</fieldset>
<input type="submit" class="submit" id="submit" value="Submit" tabindex="9" />
</form>
After validation use PHP to capture the form fields, wrap them in XML elements, then save it.
e.g.
<form>
<fname><?php=$_REQUEST['fname']?></fname>
<lname><?php=$_REQUEST['lname']?></lname>
...
..
</form>
No sense in double validation either, with one slightly different than the other. It would be annoying for the user to submit their data successfully but somehow get rejected in the backend without warning. DOMDocument is a little overkill as well.
PHP contains a class called DOMDocument specifically for the purpose of building, altering, importing and exporting XML data. If you are familiar with constructing DOM elements in Javascript, it is the same idea. Create your DOMDocument, then create each element and append those elements to DOMDocument (or that element's parent) after you've made them. After you're done there, use the save function to write it to a file.