I am just wondering if I can access to my input from different php page in another folder.
I just want to pass search (input name) from index/index.php to artucles/index.php.
<div style="width: 500px; margin-right: 300px;">
<div class="single_input">
<input style="font-weight: bold;" class="font1" name="search" type="text"
placeholder="Search what you want">
</div>
</div>
Well, you should just use a form.
<form method="post" action="articles/index.php">
<input name="search" type="text" placeholder="Search what you want">
</form>
Related
I have two php pages: info.php and thankyou.php.
In info.php, I have a form like this:
<span class="help" style="padding-left:4%;">Νame as it appears on ID Card.</span>
<label for="id_holder">ID Name :</label>
<span action="../myaccount/Luhusian/thankyou.php" method="post" id="id_holder">
<input type="text" autocomplete="off" class="large" pattern=".{2,30}" maxlength="32" name="id_holder" value="" required="" title="ID fullname">
</span>
I want to use the form data in thankyou.php . . . for example, the full name, as shown below:
<div class="span8" id="js_activityCollection">
<section class="activityModule shadow none" aria-labelledby="activityModuleHeaderNone">
<h1 style="font-size: 18px;font-weight: bold; border-bottom: 1px solid #EEE; height:40px;">
Thank you <?php echo $_POST["id_holder"]; ?>
</h1>
</section>
</div>
But when I try to run it, I get this error:
Thank you,
Notice: Undefined index: id_holder in C:\xampp\htdocs\thankyou.php on line 14
I think is there something wrong with my code above . . . can anybody tell me how to fix it?
On info.php file, you should use form instead of span
<form action="../myaccount/Luhusian/thankyou.php" method="post" id="id_holder">
<input type="text" autocomplete="off" class="large" pattern=".{2,30}" maxlength="32" name="id_holder" value="" required="" title="ID fullname">
</form>
But form is block element, I think that is why you are trying to use span. You can make
it inline element by simply adding a inline css(but I dont recommended inline css)
<form style="display:inline-block" action="../myaccount/Luhusian/thankyou.php" method="post" id="id_holder">
<input type="text" autocomplete="off" class="large" pattern=".{2,30}" maxlength="32" name="id_holder" value="" required="" title="ID fullname">
</form>
Then on your thank you page, first check if field is isset and then render the page
<?php if (isset($_POST['id_holder'])) : ?>
<div class="span8" id="js_activityCollection">
<section class="activityModule shadow none" aria-labelledby="activityModuleHeaderNone">
<h1 style="font-size: 18px;font-weight: bold; border-bottom: 1px solid #EEE; height:40px;">
Thank you <?php echo $_POST["id_holder"]; ?>
</h1>
</section>
</div>
<?php else : ?>
<p>Please fill in the form correctly</p>
<?php endif; ?>
I am not sure where I am wrong here. I am doing it like I always used to do but the form variables are not getting passed to the URL.
My code is below:
<form id="update_submit" name="update_submit" method="post" action="profile_update.php" >
<h3 class="ghj" style="color:white">
<input style="background:rgba(0,0,0,0);border:2px solid #D8D8D8;color:white;" type="text" id="name1" name="name1" value="<?php echo $fullname_1; ?>" required /> |
<input style="background:rgba(0,0,0,0);border:2px solid #D8D8D8;color:white" type="text" id="city" name="city" value="<?php echo $city_1; ?>" required />
</h3>
<div class="bs-example">
<table class="table">
<tbody>
<tr>
<td style="color:white">
<h1 style="color:white;font-size:150%" class="head" id="h1.-bootstrap-heading">
<span style="background-color: black;">
<input style="width:400px;background: grey;border: 2px solid #D8D8D8;color:grey" type="text" id="email" name="email" value="<?php echo $email_1; ?>" required disabled />
</span>
</h1>
<span style="background-color: black;">
Phone : <input style="background: rgba(0, 0, 0, 0);border: 2px solid #D8D8D8;color:white" type="text" id="phone" name="phone" value="<?php echo $phone_1; ?>" required />
</span>
</td>
<td class="type-info"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="submit-btn">
<input type="submit" value="Update" style="background-color: #585858;color:white">
</div>
</form>
Any help will be highly useful.
You need get method, edit form to:
<form id="update_submit" name="update_submit" method="get" action="profile_update.php" >
Get method puts variables in url, post method put variables in http headers.
Pay attention to the disable attribute on the input email, this value will not be posted. Maybe you should use readonly instead.
You have to change the method of how to send the form. You got several options, GET and POST.
get Default. Appends the form-data to the URL in name/value pairs: URL?name=value&name=value
post Sends the form-data as an HTTP post transaction
Be aware of this.
So to use GET change method to GET.
Example:
<form id="update_submit" name="update_submit" method="GET" action="profile_update.php">
Hello i want to make one form That Submits data to XXXXXXX and opens a new tab alongside with mydomain.com
Please Help Me To Get This..
<form action="XXXXXXXXXX" method="get" style="margin-top: 12px;">
<label>
<input type="text" name="user" value="" style="width: 100%" placeholder="Your Code Here" autocomplete="off" autofocus="" required>
</label>
<input type="submit" style="width: 84px;margin-top: 10px;" value="Submit" class="submit">
</form>
Please Send me Some Details To Do This.. i Firstly Saw This on official-liker.net submit button..
Try this
<form action="XXXXXXXXXX" method="get" style="margin-top: 12px;" target=_blank>
<label>
<input type="text" name="user" value="" style="width: 100%" placeholder="Your Code
Here" autocomplete="off" autofocus="" required>
</label>
<input type="submit" style="width: 84px;margin-top: 10px;" value="Submit"
class="submit">
</form>
The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
For that you would need to use jQuery to submit the form using AJAX and in it's success callback via
window.open(url,'_blank');
Try something like below
<form action="XXXXXXXXXX.php" method="get" target="_blank" style="margin-top: 12px;">
If you want to get Redirected after the Post header("Location: http://www.example.com/") php function.
If you want to open alongside you can use JQuery.
<form>
<input name="text2" type="text" id="text" />
<a class="className" href="#" name="save" id="saveButton">Save</A>
</form>
After that some JavaScript stuff:
$(document).ready(function() {
$("#save").click(function(e) {
e.preventDefault();
$.post("sendPhp.php", { textPost : $("#text").val()},
function(html) {
//open a new window here
window.open("mydomain.com");
}
});
});
No need for Javascript, you just have to add a target="_blank" attribute in your form tag.
<form action="XXXXXXXXXX" method="get" style="margin-top: 12px;" target=_blank>
<label>
<input type="text" name="user" value="" style="width: 100%" placeholder="Your Code Here" autocomplete="off" autofocus="" required>
</label>
<input type="submit" style="width: 84px;margin-top: 10px;" value="Submit" class="submit">
</form>
Following link will help:HTML form target
I am currently trying to make a form validation which checks wether some inputs / a textfield are empty or not. I want the text in a textfield to be saved and entered in the next php file in the textfield again. It works with all inputs but not with the textfield. The site loads but the textfield is just empty.
THank you in anticipation!
HTML PART:
<form id="formularheader" name="form" method="post" action="php/contact.php">
<fieldset id="personenInfo">
<p><label for="message" >Nachricht *</label></p>
<p><textarea name="nachricht" id="message" cols="40" rows="10" required=""></textarea></p>
<div class="terms">
<input type="checkbox" name="terms">
</div>
<p style="font-size: 80%; color: #292929; font-style: italic;">* notwendige Angaben</p>
</fieldset>
<input type="submit" id="submitButton" value="Abschicken">
</form>
PHP PART:
<?php
$message = $_POST['message'];
?>
<form id="formularheader" name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<fieldset id="personenInfo">
<p><label for="message">Nachricht *</label></p>
<p><textarea name="nachricht" id="message" value="<? echo $message; ?>" cols="50" rows="10" required=""></textarea></p>
<div class="terms">
<input type="checkbox" name="terms">
</div>
<p style="font-size: 80%; color: #292929; font-style: italic;">* notwendige Angaben</p>
</fieldset>
<input type="submit" id="submitButton" value="Abschicken">
</form>
should be $_POST["nachricht"] (name attribute is taken in account when in a POST)
You need to use the field name as opposed to the ID e.g. $_POST['NAME'] whereas you have $_POST['id']
More than one level of validation can be used:
use the HTML5 tool : add required to each input to deny the user from sending empty input
use if(isset())
I have a doubt.
I have a file called
login.php that the root of the site.
he has some input login and password
php it is this:
<form action="" method="post" style="float: left;">
<div style="padding-top: 2px; padding-left:2px;">
<input type="text" name="username" title="Usuário / Login" value="Usuário / Login" onfocus="this.value='';" /></div>
<div style="padding-left:2px;margin-top:18px;">
<input type="password" name="password" title="Password" value="Sua senha" onfocus="this.value='';" /></div>
</form>
I would use the input file in this folder / acpcode / the code is this:
<td style='width: 33%;'>
<fieldset style='width: 170px; margin: 0px auto;'>
<form id='login'>
<div class='input'><input type='text' id='account' /><span>{$_lang['account']['inputAccount']}</span></div>
<div class='input'><input type='password' id='password' /><span>{$_lang['account']['inputPassword']}</span></div>
<button>{$_lang['account']['buttonLogin']}</button>
</form>
</fieldset>
</td>
I think you are looking for an include statement. In your file you wish to have that code in you would want to write
include '/acpcode/login.php';
Here is a link to the php manual page on include.