Submission not confirmed html php - 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

Related

i want to store values in two tables but i'm able store in single table

i have two table rooinventory and reservation i want to store values in that tables but its getting inserting in rooinventory table only..
demo.php
<form name="checkoutForm" method="post" action="order.php">
<div class="container" style="float: left; width: 299px; margin-left: 12px;">
<span class="top-label">
<span class="label-txt">Room Details</span>
</span>
<div class="content-area" style="border-radius:15px;">
<div>
</div>
<div class="content drop-here">
<div id="cart-icon">
<img src="img/Shoppingcart_128x128.png" alt="shopping cart" class="pngfix" width="128" height="128" />
<img src="img/ajax_load_2.gif" alt="loading.." id="ajax-loader" width="16" height="16" />
</div>
<input name="start" type="hidden" value="<?php echo $arival; ?>" />
<input name="end" type="hidden" value="<?php echo $departure; ?>" />
<input name="numnights" type="hidden" value=<?php echo $numberofnights; ?>" />
<div>
<div id="item-list">
</div>
<div id="total"></div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<span class="top-label">
<span class="label-txt">Personal Details</span>
</span>
<div class="content-area" style="border-radius:15px; padding-bottom: 25px;">
<div>
Firstname:<br>
<input type="text" name="fname" id="boxy" pattern="[A-Za-z]{1,32}" required="" /><br>
lastname:<br>
<input type="text" name="lname" id="boxy" required="" /><br>
Address:<br>
<input type="text" name="address" id="boxy" pattern="[A-Za-z]{1,32}" required="" /><br>
City:<br>
<input type="text" name="city" id="boxy" required="" /><br>
Country:<br>
<input type="text" name="country" id="boxy" required="" /><br>
Email:<br>
<input type="email" name="email" id="boxy" /><br>
Contact Number:<br>
<input type="text" name="contact" id="boxy" required="" /><br>
<input type="hidden" name="confirmation" id="boxy" value="<?php echo $confirmation ?>" /><br>
<input type="submit" name="check" onclick="document.forms.checkoutForm.submit(); return false;" class="button" value="Checkout" id="boxy" style="width: 147px; margin-top: 18px;">
</div>
</div>
</div>
</form>
order.php
<?php
$confirmation = $_POST['confirmation'];
$numnights=round($_POST['numnights']);
$arival=$_POST['start'];
$departure=$_POST['end'];
$firstname=$_POST['fname'];
$lastname=$_POST['lname'];
$address=$_POST['address'];
$city=$_POST['city'];
$country=$_POST['country'];
$email=$_POST['email'];
$contact=$_POST['contact'];
$stat='active';
$roomid=$_POST['id'];
$qty=$_POST['qty'];
$price=$_POST['price'];
$roomname=$_POST['roomname'];
$N = count($roomid);
$ip_sqlq=mysql_query("select * from rooinventory where confirmation='$confirmation' and arrival='$arival'and departure='$departure'");
$countq=mysql_num_rows($ip_sqlq);
if($countq==0)
{
for($i=0; $i < $N; $i++)
{
mysql_query("INSERT INTO rooinventory (room, qty, arrival, departure, status, confirmation) VALUES ('$roomid[$i]','$qty[$i]','$arival','$departure','$stat','$confirmation')");
echo '<h2>'.$qty[$i].' x '.$roomname[$i].' = '.$ble=$qty[$i]*$price[$i].'</h2>';
echo '<div style="display:none;">';
$dddd=$ble;
$total=$total+$dddd;
echo '</div>';
}
mysql_query("INSERT INTO reservation (firstname, lastname, city, address, country, email, contact, arrival, departure, result, payable, status, confirmation) VALUES ('$firstname','$lastname','$city','$address','$country','$email','$contact','$arival','$departure','$numnights','$total','$stat','$confirmation')");
header("location: paypalpayout.php?confirm=$confirmation");
}
else{
header("location: ../index.php");
}
?>
Could it be the data in one of your variables is causing the second query to fail? Since they're not bound as parameters or at least escaped, they could be altering your actual query. For instance, if there's an apostrophe in any of your data, it's going to break the query.

my page is not redirecting properly

I have a popup which shows up if the user is not logged in. It contains a cancel link, a form to enter details, and a forget password link. My problem is when the user comes back from the forget password link and clicks the cancel link, it takes them back to the forget password page.
Here is my code.
<div class="contactForm_new" id="popUpDiv" style="display:none;">
<!--<div class="lightBlue heading" >Tell us your Buy Requirement</div>-->
<div class="blueLightBG heading" style="text-align: left;
padding-left: 2%;background-color:#009bcb ">Enter Password <span class=" dpbl fr mainSp cr_bt2 p_a closeTrigger closePopup href" style="position: absolute; display: block;"></span></div>
<form method="post" class="contactF" id="login-form">
<input type="hidden" value="" name="offerid">
<input type="hidden" value="" name="refvalue">
<input type="hidden" value="" name="tenderid">
<input type="hidden" value="" name="item_id">
<input type="hidden" value="" name="pid">
<input type="hidden" value="sd" name="ref">
<input type="hidden" value="1" name="isLogRequest">
<input type="hidden" name="iso" id="iso" value="<?php echo $details['iso'] ?>">
<input type="hidden" value="<?php echo $return_en_url ?>" id="p_address" name="p_address">
<div class="errorMessage" id="errorUsername"></div>
<input type="hidden" name="diff_usr" value="Y">
<input type="hidden" value="Y" name="diff_usr">
<input class="pd3 textlogin_new" name="LoginForm[password]" id="LoginForm_password" type="password">
<div class="errorMessage" id="errorPassword"></div>
<div style="padding:15px 0;text-align:center">
<span id="imgprcp" class="fl" style=" display: none; text-align: center;margin-left:50%;"><img src="<?php echo Yii::app()->params['hostName'] ?>/images/ind.gif" alt="Proceeding"></span>
<input id="btnSubmit" type="button" name="yt0" value="Proceed" class="redBtn_new" >
</div>
<div class="mb3per" style="display:block">
<p class="k7_new" style="position:absolute;" >
<a class="k7_new" id="forgotpass" style="position:relative;" href="<?php echo Yii::app()->params['hostName'] ?>/forgotpass/?ref=<?php echo $ref ?>&p=<?php echo $return_en_url ?>" >Forgot Password?</a>
</p>
</div>
</form>
</div>
Can anybody suggest what am I doing wrong? All of my URLs are formed correctly.This problem is coming in only chrome browser.In another browser it is working fine

PHP form variables not getting passed to the URL

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

How To Make .php form submit button two actions

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

html form is being sent on reset button

I have a problem with the html form.
This is my code:
<form name="contactform" method="post" action="send_form_email.php">
<input id="first_name" type="text" name="first_name" size="30"/>
<input id="company_name" type="text" name="company_name" size="30"/>
<input id="email" type="text" name="email" size="30"/>
<input type="image" align="middle" src="images/accept.png" alt="Submit" /> <input id="reset" type="image" src="images/reset.png" alt="Reset" align="middle" />
</form>
when I click any of this images my form is sent. How can I make this reset picture to only reset and not to send the form.
Your reset button is not a reset button. It has type="image", it is server side image map.
When you click on a server side image map the form will be submitted and the coordinates you clicked on will be included in the data.
If you want a reset button that is an image use:
<button type="reset"><img src="..." alt="..."></button>
The image type is like a submit button.
You have to take type="reset" and style your button with css.
Use
<input type = "reset" value = "" class = "btnResetClass" />
Your, btnResetClass will have Css Setting for background image to be set by you.
You have to use type="reset".
This jsFiddle example would be better.
HTML:
<form id="contactform" method="post" action="send_form_email.php">
<div>
<label>
First Name: <input id="first_name" name="first_name" type="text" size="30" />
</label>
</div>
<div>
<label>
Company Name: <input id="company_name" name="company_name" type="text" size="30" />
</label>
</div>
<div>
<label>
Email: <input id="email" type="text" name="email" size="30" />
</label>
</div>
<input id="submit" type="submit" value="" title="Submit" />
<input id="reset" type="reset" value="" title="Reset" />
</form>
CSS:
#submit, #reset {
border: none;
width: 64px;
height: 48px
}
#submit {
background: url('images/submit.png')
}
#reset {
background: url('images/reset.png')
}

Categories