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.
Related
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>
I have an form with submit button as follows in html :-
<div style="display: flex;">
<form name="myform"method="post" action="usdbtc.php" style="float:left;">
<div id="log_err"> <strong><?php if(isset($logerror)) { echo $logerror; } else { $dn = 'dn'; } ?></strong> </div>
<p><label style="float: left;">Price:</label><input class="input101" style="float: left;" type="text" name="username" id="box1" oninput="calculate()"><label style="float: right;">: BTC</label><input class="input101" style="float: right;" type="text" name="username" id="box2" oninput="calculate()">
<br><input class="input101" style="float: right;" type="text" name="username" id="result"><br><label style="padding: 10px;">Total BTC:</label>
<td rowspan="2">
<input type="hidden" id="myform" value="1"/>
<br><span class="orderbutton" type="submit" id="ordersell" onclick="myform.submit()">SELL</span></p>
</td>
</form>
<form name="yourform"method="post" action="usdbtc.php" style="float:right;">
<p><label style="float: left;">Price:</label><input class="input101" style="float: left;" type="text" name="username" id="box3" oninput="calculate()"><label style="float: right;">: BTC</label><input class="input101" style="float: right;" type="text" name="username" id="box4" oninput="calculate()">
<br><input class="input101" style="float: right;" type="text" name="username" id="resul"><br><label style="padding: 10px;">Total BTC:</label>
<td rowspan="2">
<input type="hidden" id="yourform" value="1"/>
<br>
<span class="orderbutton" type="submit" id="orderbuy" onclick="yourform.submit()">BUY</span></p>
</td>
</form>
</div>
And to check whether user clicked 'SELL' button i do in php :-
if($_POST['myform']){
echo 'yes';
}
else {
echo 'no';
}
I am always getting no after clicking button, is there anything wrong that I haved coded in the html or php part? Help is appreciated.. I just want to get the part for php
if($_POST['?']) {...
Remember there are two forms in the page with each having name and hidden input id.
<input type="hidden" id="myform" value="1"/>
Change id attribute to name
<input type="hidden" name="myform" value="1">
And there's a missing space in form tag
I have tried so many times in different ways to solve this. Every time it generates the same output. I searched in [http://google.com] and [http://youtube.com] and followed many tutorials, and implemented my code according them..Their code runs properly but my code gives unknown output, though their code and my code is same.
This is the PHP code:
if(!isset($_POST["radio"])){
$radioMsg="You must Select a Category!";
}
if(isset($_POST["radio"])){
$radio=$_POST["radio"];
}
There is the radio Buttons
<form method="post" action="register.php" enctype="multipart/form-data"
style="width: 860px;margin: 0px;height: 580px;">
<input class="form-control" type="" name="name" placeholder="Name..."/
style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="email" name="email"
placeholder="Email..."/ style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="password" name="password"
placeholder="Password"/ style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="password" name="cPassword"
placeholder="
confirm Password..."/ style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="text" name="contactNO"
placeholder="Your
contact No.."/ style="width: 400px; margin-left: 200px" ><br>
<input type="file" name="image"/ style="width: 400px; margin-left:
200px">
<br><br>
<div style="border: 1px solid #4C6A6D;width: 250px;margin-left: 200px" >
<?php echo $radioMsg ?>
<h6 style="margin-left: 20px">Select a Cetagory</h6>
<input type="radio" name="radio" value="customer" style="margin-left:
25px">Customer<br>
<input type="radio" name="radio" value="DespensaryOwner" style="margin-
left:
25px">Despensary Owner<br>
input type="radio" name="radio" value="dealer" style="margin-left:
25px">Dealer<br>
</div>
<br>
<input class="btn-primary" type="submit" name="submit" value="Register"
style=" margin-left: 200px"><br><br>
</form>
if select radioButton1, it returns a value "radio" instead of value "customer"
Input type cannot be "cust":
<input type="radio" name="g" value="customer" style="margin-left:
25px">Customer<br>
<input type="radio" name="g" value="DespensaryOwner" style="margin-left:
25px">Despensary Owner<br>
<input type="radio" name="g" value="dealer" style="margin-left:
25px">Dealer<br>enter code here
Try code above and see if that works, also you should use better name values as suggested in the comments of this answer
I went ahead and ran this locally, by putting it all in a file called "register.php" in the root of a PHP dev server instance, with the PHP code at the top. In that situation, it spits out the error until a valid value is put in, but I imagine you're handling things differently.
I had to remove a number of strange forward slashes and line returns in your HTML, there were missing < and >, and your radio buttons were all named "radio", but after correcting those errors, the code below works:
PHP: (Included PHP tags for completeness)
<?php
if(!isset($_POST["category"])){
$radioMsg="You must Select a Category!";
}
if(isset($_POST["category"])){
$radioMsg="";
$radio=$_POST["category"];
}
?>
HTML: (Included entire html layout for completeness.)
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="register.php" enctype="multipart/form-data" style="width: 860px;margin: 0px;height: 580px;">
<input class="form-control" type="" name="name" placeholder="Name..." style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="email" name="email" placeholder="Email..." style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="password" name="password" placeholder="Password" style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="password" name="cPassword" placeholder="confirm Password..." style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="text" name="contactNO" placeholder="Your contact No.." style="width: 400px; margin-left: 200px" ><br>
<input type="file" name="image" style="width: 400px; margin-left: 200px">
<br><br>
<div style="border: 1px solid #4C6A6D;width: 250px;margin-left: 200px" >
<?php echo $radioMsg ?>
<h6 style="margin-left: 20px">Select a Category</h6>
<input type="radio" name="category" value="customer" style="margin-left: 25px">Customer<br>
<input type="radio" name="category" value="DispensaryOwner" style="margin-left: 25px">Dispensary Owner<br>
<input type="radio" name="category" value="dealer" style="margin-left: 25px">Dealer<br>
</div>
<br>
<input class="btn-primary" type="submit" name="submit" value="Register"
style=" margin-left: 200px"><br><br>
</form>
</body>
</html>
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; ?>
Here's the code:
<div id="regpage">
<form action="" method="post">
<fieldset style="border:none;">
<div class="label">Username:</div> <input type="text" name="username" class="item" value="" /><br />
<div class="caption">Must be 5-15 characters</div><br />
<div style="clear:both;"></div>
<div class="label">Password:</div> <input type="password" name="password" class="item" value="" /><br />
<div class="caption">Must be 6-20 characters</div><br />
<div style="clear:both;"></div>
<div class="label">Email:</div> <input type="text" name="email" class="item" value="" /><br />
<div class="caption">Valid email address is required</div><br />
<div style="clear:both;"></div>
<input name="terms" type="checkbox" id="terms" value="agree" /><div class="caption2"><label for="terms">I agree to the terms and conditions</label></div>
<p><input type="submit" name="register" value="Register" id="register" style="float:left;border:1px solid #999;background:#E4E4E4;margin-top:5px;" /></p><br />
</fieldset>
</form>
</div>
And the id "regpage" is definded in the style.css as:
#regpage {
width: 356px;
height: 150px;
color: #000000;
font-family: "Tahoma", Arial, Helvetica, sans-serif;
font-size: 13px;
}
If I move the checkbox OUT of <div id="regpage"> it works just fine. But inside it will not interact in Mozilla. I've even tried adding onclick='this.checked="checked"' and it still does not interact. You can click until your blue in the face and nothing will happen.
What's the deal! This is REALLY driving me batty.
I don't see any problem: http://jsfiddle.net/cXRPd/ (Firefox 3.0.19)
Found it myself: My div's height wasn't set high enough. It didn't expand enough to cover the checkbox.
Setting the height to 250 fixed the problem.
My overflow is set to hidden, but apparently it still blocked the ability to interact with the box.