PHP form variables not getting passed to the URL - php

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">

Related

Get input name from different page in different folder

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>

Submission not confirmed html php

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

How to pass data from a form in on PHP into the HTML of another PHP

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; ?>

Pass a input value with url in php

I want to pass a input value with a url.
<div class="modal-body">
<div id="myDiv" class="answer_list">
<form action="" id="usrform" method="get">
<textarea name="comment" style="width: 450px; height: 80px; form="usrform"></textarea>
<?php echo '<a href="reject_request.php?leave_id='.$id1.'&emp_id='.$emp_id.'">'?>
<button style="float: right" type="button" class="btn btn-primary" name="submit">
Proceed
</button></a></form></div>
</div>
Here I want to pass the textarea input value to 'reject_request.php' page with other variables. I couldn't able to find a way, Can any one help me !
Use method="POST" and action="reject_request.php"
<form action="reject_request.php" id="usrform" method="POST">
<textarea name="comment" id="comment"></textarea>
<input type="hidden" name="leave_id" id="leave_id" value="<?php echo $id1; ?>">
<input type="hidden" name="emp_id" id="emp_id" value="<?php echo $emp_id; ?>">
</form>
In reject_request.php you can access the form datas via $_POST['comment'],$_POST['leave_id'],$_POST['emp_id']
First of all, it is not advisable to pass long content in URL, as commented by #Dhara Parmar.
But if you want to do it,
<form action = "yourpage.php" .... as, again, commented by splash 58
As far as accessing those variables are concerned, you can access them via ASSOCIATIVE GLOBAL ARRAY $GET[KEY]

How to input data into input fields whose names are changing after every visit in php?

I have been trying to input some data into following fields but since there are too many fields, most of them are hidden and only 2 are visible. So I'm wondering if there is any way in php so that I can input data into only visible input fields and then submit them using curl or anything. Which would you suggest? Then I want to run a loop to enter different data into the fields from a comma separated value file, text file or may be in a string?
The div name and input names are changing on every visit so can't even target with name or id etc..
Here is the form code which I am trying to target but since it's changing every time so how it can be done please :
<form action="" method="post">
<div class="uzuyjgec">
<input name="kAEuwLjmplRMZazfl/s9bW6YpnOxDDX2/2K0sobG" class="tbox" type="text">
</div>
<div class="tyqtmvha">
<input name="kwHKrLjmplTDzY/lMx57neltV9ErW378S1mX9h5S" class="tbox" type="text">
</div>
<input name="submit" value="Search!" class="tbox" type="submit">
</form>
I just took out the code for the inputs but it's so confusing. There are too many inputs in the code...!
Here is full original code in live state : http://jsfiddle.net/rt1ff6ab/
It's showing as too many inputs in live state in jsfiddle but it's showing only 2 inputs in the site here it screenshot please as :
http://i.stack.imgur.com/451QH.png
Ok, just try this example. I hope it will help some where in your problem.
<html>
<head>
<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var ctr = 1;
$('form input[type="text"]').each(function(){
ctr++;
$(this).val("Hello"+ctr);
});
});
</script>
</head>
<body>
<form action="" method="post">
<table cellspacing="2" cellpadding="2" style=" border-bottom: 0px solid #3D4456;border-left: 0px solid #7885A7; border-right: 0px solid #3D4456; border-top: 0px solid #6F7B9A; ">
<tbody>
<tr>
<td class="header" colspan="3"><div align="center" class="unnamed1">Search</div></td>
</tr>
<input type="hidden" name="postsecret" class="tbox" value="ae12ee24d353a1ce0d0f1d2b4e6a9c2a">
<tr>
<td bgcolor="#000033"><font color="#999999">Username:</font></td>
<td bgcolor="#000033"><div class="ppeahrsb"><input name="fQCOA43HplS/DtcTleFoEfPHCizE4LzJ4oOsG4fm" type="text" class="tbox"></div>
<div class="dgodcaqx"><input name="gABI/43HplSxMbsniwA81un550YMF6cB3z3q2vb8" type="hidden" class="tbox"></div>
<div class="acaramne"><input name="hACwfI3HplSRnmWaKbVT4V8aFFs2XGpg+N15SlRf" type="hidden" class="tbox">
</div><div class="wdxcabya"><input name="hwDWBI3HplTB/9FW5XWsZibHLpXB9/Pegwqgxbtb" type="hidden" class="tbox"></div>
<div class="dgodcaqx"><input name="igBZG43HplRHwYqQKxsvLtXuXHcO9KIa8jWECGT9" type="hidden" class="tbox"></div>
<div class="ppeahrsb"><input name="jgAs5I3HplSomQBfoWfBRCKpXppHgFFjk//nLIF/" type="hidden" class="tbox"></div>
<div class="acaramne"><input name="kQB//o3HplSZgWVqig2sBIuo92E0ga0D4OxE1Crg" type="hidden" class="tbox"></div></td>
</tr>
<tr>
<td bgcolor="#000033"><font color="#999999">Hours:</font></td>
<td bgcolor="#000033"><div class="acaramne"><input name="lQBJyo3HplRt9Dd6P/A8ypTKWxuJyQaptYk/Zlnn" type="text" class="tbox"></div>
<div class="ppeahrsb"><input name="mAAYtY3HplTmD5Fo/bkZyhLkdC02BhbEVrURmNqJ" type="hidden" class="tbox"></div>
<div class="dgodcaqx"><input name="mwCxjY3HplRmf08annwDVJVGPhzAt/Vvj4F00Q98" type="hidden" class="tbox"></div>
<div class="wdxcabya"><input name="nwBNT43HplTVt8dIeYA1AII+F84hD5+tAf6kjS83" type="hidden" class="tbox"></div>
<div class="acaramne"><input name="ogCM9Y3HplS0beyr8v+Twl+TJWbP+PpNEtLzZgbQ" type="hidden" class="tbox"></div>
<div class="dgodcaqx"><input name="pgB32I3HplQ6Jp5wnlOA4/Ndjqkt1AURhf4Yu1Et" type="hidden" class="tbox"></div>
<div class="ppeahrsb"><input name="qQBjv43HplTr3qe2Kjuo8afgC9WWkrzU5fDpsW+Q" type="hidden" class="tbox"></div></td>
</tr>
<tr><td><input name="submit" type="submit" value="Search!" class="tbox"></td></tr>
</tbody>
</table>
</form>
</body>
</html>
You will have to simulate a complete transaction. So
Use cUrl to load the form and enable cookies so you establish a session
Use Simple HTML DOM parser (or similar) to retrieve the field names
Use same cUrl session, post values for fields found in step 2

Categories