i Have a one problem want to share with all of you.
I am develop a custom page in WordPress here is the link of the page http://muhammadimran.info/testing/ when i try to click on new document button and try to submit form it give me error. Here is my code for this please tell me how i can give link in WordPress in action
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<form action="home1.php" enctype="multipart/form-data" method="POST">
<div class="form-group">
<label for="name1">Name</label>
<input name="name" class="form-control" type="text" />
</div>
<div class="form-group">
<label for="title">Title</label>
<input name="title" class="form-control" type="text" />
</div>
<div class="form-group">
<label for="Startdate">Start Date</label>
<input id="datepicker" class="form-control" class="datepicker" type="text" name="start" required="" />
</div>
<div class="form-group">
<label for="Enddate">End Date</label>
<input id="datepicker1" class="form-control" class="datepicker" type="text" name="end" required="" />
</div>
<div class="form-group">
<label for="Users">Users</label>
<input type="text" class="form-control" name="users" />
</div>
<div class="form-group">
<label for="Fileupload">File Upload</label>
<input type="file" class="form-control" name="file" class="file" name="file" required="">
</div>
<input type="submit" id="submit" class="btn btn-primary submitbutton" name="submit">
</form>
</div>
</div>
You should follow the beloe steps:
create a Template:
Home1 Template with file name home1.php
create a page and select the recently create template (Home1 Template).
replace the form action
<form action="home1.php" enctype="multipart/form-data" method="POST">
with
<form action="http://siteur/templateur/" enctype="multipart/form-data" method="POST">
in home1.php
print_r($_POST);
Related
Path to put form code:
public_html/wp-content/plugins/latepoint/lib/views/customers/dashboard.php
code form:
<form action="update_domain.php" method="post">
<div class="form-group mb-3">
<label for="">Old domain</label>
<input type="text" name="olddomain" class="form-control" />
</div>
<div class="form-group mb-3">
<label for="">New domain</label>
<input type="text" name="newdomain" class="form-control" />
</div>
<div class="form-group mb-3">
<label for="">Username</label>
<input type="text" name="username" class="form-control" />
</div>
<div class="form-group mb-3">
<button type="submit" name="Submit" class="btn btn-primary">Save Data</button>
</div>
</form>
Below path to action code:
public_html/wp-content/plugins/latepoint/lib/views/customers/update_domain.php
Now when I click on sumbit and try run form then I get error:
URL: mywebsite.com/customer-dashboard/updatedomain.php
404
Looks like you are lost.
We can’t seem to find the page you’re looking for.
I created an application form with HTML and on that application the user has to upload his resume. I was thinking to create a form within the form to let the user upload his resume such as:
<div class="application-form">
<form class="contact-form" action="application-form.php" method="post">
<div class="application-data">
<label>First Name</label>
<input type="text" name="first">
</div>
<div class="application-data">
<label>Last Name</label>
<input type="text" name="last">
</div>
<div class="application-data">
<label>Email</label>
<input type="email" name="email">
</div>
<div class="application-data">
<label>Phone Number</label>
<input type="phone" name="phone">
</div>
<div class="resume">
<form action="">
<label>Resume</label>
<input type="file" name="resume">
<button type="submit">Submit Resume</button>
</form>
</div>
</form>
</div>
Seems this is not possible in HTML. What is the best alternative? thanks
I don't see the need for the nested form here...just remove it and make the file upload part of the application-form.php handler. Also add the enctype attribute to your <form> to accept files.
<div class="application-form">
<form class="contact-form" action="application-form.php" method="post" enctype="multipart/form-data">
<div class="application-data">
<label>First Name</label>
<input type="text" name="first">
</div>
<div class="application-data">
<label>Last Name</label>
<input type="text" name="last">
</div>
<div class="application-data">
<label>Email</label>
<input type="email" name="email">
</div>
<div class="application-data">
<label>Phone Number</label>
<input type="phone" name="phone">
</div>
<div class="resume">
<label>Resume</label>
<input type="file" name="resume">
<button type="submit">Submit Resume</button>
</div>
</form>
</div>
I'm trying to make a button that submits order input to a database and then takes the user to the home page on my site, but I don't know how to do it. Here is my code:
<button type="submit" class="btn btn-primary" onclick="window.location.href='PurimHome.html'"> Place Order</button>
This button sends the info to the db but it doesn't go to the home page.
Here is more of the code:(I'm using bootstrap)
<form class="form-horizontal" action="" method="post">
<label class="col-sm-2" >Credit Card Number</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="creditnum" name="creditnum" placeholder="Credit Card Number" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2" >Expiration Date</label>
<div class="col-sm-10">
<input type="date" class="form-control" id="date" name="date" placeholder="Expiration Date" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2" >Security Code</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="code" name="code" placeholder="Three Digit Code" >
</div>
</div>
<input type="checkbox" name="contact" id="contact" value="Phone"> Contact Me by Phone<br>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" onclick="window.location.href='PurimHome.html'"> Place Order</button>
</div>
</div>
</form>
If you want to relocate to a different site after you submit.. then maybe you should place in your controller something like..
if(isset($_POST['submit'])){
//do stuff if needed
header('Location: url');
}
so that after you submit the form it will then redirect you to antoher location of your choosing.
I´m quite new to php so this might just be a stupid question. Is there a way to put the submit button into another form field, or must it be the same? Does it really matter if I create a new field somewhere else?
Not working Code:
<div class="container">
<form method="post">
<div class="form-group">
<input type="text" class="form-control" name="emailfield" id="emailfeld2" placeholder="Emailadresse (z.B Max#Max.de)">
<input type="password" class="form-control" name="passwordfield" id="passwortfeld" placeholder="Passwort">
<input type="password" class="form-control" name="cpasswordfield" id="cpasswortfeld" placeholder="Passwort bestätigen">
</div>
</form>
<div class="form-group">
<form method="post">
<button type="submit" class="btn btn-success" name="submitgo">Sign Up!</button>
</form>
</div>
</div>
<?php
echo $_POST['emailfield']."<br>";
?>
<div class="container-opacity">
</div>
Working code:
<div class="container">
<form method="post">
<div class="form-group">
<input type="text" class="form-control" name="emailfield" id="emailfeld2" placeholder="Emailadresse (z.B Max#Max.de)">
<input type="password" class="form-control" name="passwordfield" id="passwortfeld" placeholder="Passwort">
<input type="password" class="form-control" name="cpasswordfield" id="cpasswortfeld" placeholder="Passwort bestätigen">
<button type="submit" class="btn btn-success" name="submitgo">Sign Up!</button>
</div>
</form>
</div>
<?php
echo $_POST['emailfield']."<br>";
?>
<div class="container-opacity">
</div>
It is generally bad practice to have form elements outside of the form they belong to. It will work if you only have one <form> tag and move it outside of you main <div class="container">
<form method="post">
<div class="container">
<div class="form-group">
<input type="text" class="form-control" name="emailfield" id="emailfeld2" placeholder="Emailadresse (z.B Max#Max.de)">
<input type="password" class="form-control" name="passwordfield" id="passwortfeld" placeholder="Passwort">
<input type="password" class="form-control" name="cpasswordfield" id="cpasswortfeld" placeholder="Passwort bestätigen">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success" name="submitgo">Sign Up!</button>
</div>
</div>
</form>
<?php echo $_POST[ 'emailfield']. "<br>"; ?>
<div class="container-opacity">
</div>
I have a form like below:
<form id="bookForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0].title" placeholder="Title" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0].isbn" placeholder="ISBN" />
</div>
<div class="col-xs-2">
<input type="text" class="form-control" name="book[0].price" placeholder="Price" />
</div>
<div class="col-xs-1">
<button type="button" class="btn btn-default addButton"><i class="fa fa-plus"></i></button>
</div>
</div>
How to get value of this form in php $_Post because the name of fields are like <br/>name="book[0].title"**<br/>?
and there are many dynamic different name input fields.
If you can use for multiple books then use book[0].title like below,
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][title]" placeholder="Title" />
</div>
If you want to use same form then change name of all textbox like,
<form id="bookForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][title]" placeholder="Title" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][isbn]." placeholder="ISBN" />
</div>
<div class="col-xs-2">
<input type="text" class="form-control" name="book[0][price]" placeholder="Price" />
</div>
<div class="col-xs-1">
<button type="submit" class="btn btn-default addButton"><i class="fa fa-plus"></i></button>
</div>
</div>
And get value of this form like echo $_POST['book'][0]['title'];
I hope this can help you.
You need to change name attribute,
<div class="col-xs-4">
<input type="text" class="form-control" name="book_title" placeholder="Title" />
</div>
book[0].title, this is not valid name.
You can now get something like this,
$_POST['book_title']