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
Related
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 am trying to reload page using onClick="location.href='Edit_Equip.php?txtidforsite='" /> but i get Notice: Undefined variable: id
i have tried to define id but still get errors any help would be great
<?php
include('connect.php');
if(isset($_POST['txtidforsite']))
{
$id=$_POST['txtidforsite'];
if(isset($_POST['submit']))
{
$query3 = mysql_query("UPDATE ftn_site_equip SET siteidequip='".$_POST['txtidforsite']."', patype='".$_POST['txtpa']."', drxtype='".$_POST['txtdrx']."' WHERE siteidequip='$id'");
if($query3)
{
header('refresh:2; url=#openModa3');
}
}
$query1=mysql_query("select * from ftn_site_equip where siteidequip='$id'");
$query2=mysql_fetch_array($query1);
?>
<form method="post" action="" align="center">
<input name="txtidforsite" value="<?php echo $query2['siteidequip']; ?>" size="36" class="siteinfotable"/>
<input name="txtdrx" value="<?php echo $query2['drxtype']; ?>" size="36" class="siteinfotable"/>
<input name="txtpa" value="<?php echo $query2['patype']; ?>" size="36" class="siteinfotable"/>
<input type="submit" name="submit" class="update_record_button" value="Update Record" onclick="window.location='#openModal2';" />
</form>
<?php
}
?>
<div id="openModal" class="cancel_modal">
<div align="center">
<h2 align="center">Are you sure you want to cancel all changes ?</h2>
<input name="yes" type="button" value="Yes" class="yes_button" onClick="location.href='Edit_Form.php?txtid='" />
<input name="no" type="button" value="No" class="no_button" onclick="location.href='#close'"/>
</div>
</div>
<div id="openModal2" class="cancel_modal">
<div align="center">
<img alt="" src="Images/tick.jpg"/><br/>
<h2 align="center">Record Successfully Updated</h2>
</div>
</div>
<div id="openModa3" class="cancel_modal">
<div align="center">
<h2 align="center">What Next ?</h2>
<input name="yes" type="button" value="Retrun to Site Information" class="yes_button" onClick="location.href='Edit_Equip.php?txtidforsite=<?php echo $id; ?>'" />
<input name="no" type="button" value="Search for Another Site" class="no_button" onclick="location.href='search.php'"/>
</div>
</div>
I'm using the PHPmotion script: http://demo.phpmotiontemplates.com/default/
and I've succeeded in getting the Log-In Form (on the home page) to disappear, once it successfully performs it's function, (which is what I'm trying to accomplish), but as soon as the Log-In function succeeds, and the "sub-menu" on the home page appears,
the Log-In Form reappears again (on the homepage).
So, I'm assuming the sub-menu has something to do with the Log-In Form reappearing.
Which looks like this:
<form action="../login.php" method="post" accept-charset="UTF-8" class="middletext"
onsubmit="javascript:this.style.display='none';">
<p>
<input type="text" size="20" name="user_name_login" id="user_name_login" value="ENTER USERNAME" style="color:#D9D9D9" style="vertical-align:middle"; onfocus="if (this.value=='ENTER USERNAME') {this.value=''; this.style.color='#696969';}" >
<input type="text" size="20" name="password_login" id="password_login" value="ENTER PASSWORD" style="color:#D9D9D9" style="vertical-align:middle"; onfocus="if (this.value=='ENTER PASSWORD') {this.value=''; this.style.color='#696969';}" >
<input type="hidden" name="cookie_time" value="10080" />
<img src="../themes/default/images/arrow-red.png" alt="" /><input type="submit" style="outline:grey" font-size="5px" value="[var.lang_login_now]" class="button-form2" />
<input type="hidden" name="submitted" value="yes" />
<input type="hidden" name="remember_me" value="remember_me" />
</p>
</form>
</div>
<!--Begin Sub-Navigation. This only appears when a user is logged in.-->
<div class="container1">
<div class="menu1">
<div class="sub-nav"> <img src="../themes/default/images/arrow-red.jpg" style="vertical-align:middle" alt="" /> my account<img src="../themes/default/images/arrow- red.jpg" style="vertical-align:middle" alt="" />
[var.lang_my_credits]: [var.member_credits]</font><img src="../themes/default/images/arrow-red.jpg" style="vertical-align:middle">[var.login_out]
<!--[onload;block=div;when [var.loggedin]=1;comm]-->
</div>
Any thoughts/solution about this will be greatly appreciated.
<?php
if(!isset($_SESSION['YOUR-SESSION-NAME'])){
echo '<form action="../login.php" method="post" accept-charset="UTF-8" class="middletext"
onsubmit="javascript:this.style.display=\'none\';">
<p>
<input type="text" size="20" name="user_name_login" id="user_name_login" value="ENTER USERNAME" style="color:#D9D9D9" style="vertical-align:middle"; onfocus="if (this.value==\'ENTER USERNAME\') {this.value=\'\'; this.style.color=\'#696969\';}" >
<input type="text" size="20" name="password_login" id="password_login" value="ENTER PASSWORD" style="color:#D9D9D9" style="vertical-align:middle"; onfocus="if (this.value==\'ENTER PASSWORD\') {this.value=\'\'; this.style.color=\'#696969\';}" >
<input type="hidden" name="cookie_time" value="10080" />
<img src="../themes/default/images/arrow-red.png" alt="" /><input type="submit" style="outline:grey" font-size="5px" value="[var.lang_login_now]" class="button-form2" />
<input type="hidden" name="submitted" value="yes" />
<input type="hidden" name="remember_me" value="remember_me" />
</p>
</form>
</div>
<!--Begin Sub-Navigation. This only appears when a user is logged in.-->
<div class="container1">
<div class="menu1">
<div class="sub-nav"> <img src="../themes/default/images/arrow-red.jpg" style="vertical-align:middle" alt="" /> my account<img src="../themes/default/images/arrow- red.jpg" style="vertical-align:middle" alt="" />
[var.lang_my_credits]: [var.member_credits]</font><img src="../themes/default/images/arrow-red.jpg" style="vertical-align:middle">[var.login_out]
<!--[onload;block=div;when [var.loggedin]=1;comm]-->
</div>';
} else {
echo 'You\'re already logged in!';
}
?>
I wanted to make a search form with GET but there seems to be a problem. The page you are looking at has other GET values too but it seems that the GET method clears the URL from variabels en goes like "?q=SEARCH" instead of "?p=Test&u=Bart&q=SEARCH".
This is the form code I'm using:
<form method="GET" action="test.php?p=glistentries&maingroup=<? echo $MainGroupID ?>&subgroup=<? echo $SubGroupID ?>">
<input type="text" class="form-control" id="focusedinput" value="<? echo $_GET['q']; ?>"
name="q" autocomplete="off" class="col-sm-4 control-label" placeholder="Search...">
<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
</form>
Solved It
Thanks guys, forgot I can simply do this with hidden fields
Add the additional GET vars as hidden inputs:
<input type="hidden" name="p" value="Test">
Use input type hidden :
<form method="GET" action="test.php">
<input type="text" class="form-control" id="focusedinput" value="<? echo $_GET['q']; ?>" name="q" autocomplete="off" class="col-sm-4 control-label" placeholder="Search...">
<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
<input type="hidden" name="p" value="glistentries" />
<input type="hidden" name="maingroup" value="<? echo $MainGroupID ?>" />
<input type="hidden" name="subgroup" value="<? echo $SubGroupID ?>" />
</form>
What I'm trying to do here is display my login information and once logged in display something else
Example is here
<?php
$user = JFactory::getUser();
$status = $user->guest;
if($status == 1){
echo '
<form id="login-form" class="form-inline" method="post" action="/home">
<div class="topUser">
Name:
<input id="modlgn-username" class="TopinputReg" type="text" placeholder="User Name" tabindex="0" name="username" />
</div>
<div class="toppass">Password:
<input id="modlgn-passwd" class="TopinputReg" type="password" placeholder="Password" tabindex="0" name="password" pwfprops="," />
</div>
<div class="topsignin">
<input class="Signin" name="Submit" tabindex="0" type="submit" value="" />
</div>
<div class="topregister">
<input name="button" type="submit" class="Register" id="button" value="" />
</div>
<input type="hidden" value="com_users" name="option">
<input type="hidden" value="user.login" name="task">
<input type="hidden" value="aW5kZXgucGhwP0l0ZW1pZD0xMzM=" name="return">
<input type="hidden" value="1" name="39ea5446d876078c6f6221d396ef5bd4">
</form>
';
}
else
{
echo '
<div class="topUser">Welcome Back!</div>
<div class="toppass">Enjoy you stay.</div>
<form id="login-form" class="form-vertical" method="post" action="/log-out">
<div class="topsignin">
<input class="Signout" type="submit" value="" name="Submit" />
<input type="hidden" value="com_users" name="option">
</div>
<input type="hidden" value="com_users" name="option">
<input type="hidden" value="user.logout" name="task">
<input type="hidden" value="aW5kZXgucGhwP0l0ZW1pZD0xMDE=" name="return">
<input type="hidden" value="1" name="994c61f8ab4ccf23fe9dae6546a87089">
</form>
<div class="topregister">
<input name="button" type="submit" class="account" id="button" value="" />
</div>
';
}
?>
No I know what I am doing wrong just have no clue how to fix it. the two
need to have a different generated number each time but how do i do this.
since this numbers are the same every time if i log in then out then try to log back in it will give me "Invalid Token"
When i go into the login template it gives me
this for login
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url', $this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
and this for log out
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('logout_redirect_url', $this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
Now if I replace the hidden fields that already have the pregenerated numbers with the php stuff above when i try to refresh my page it goes completely blank.
I am at a loss with this see as how I am not very advanced in php. any help anyone cant provide would be massively helpful..
why not try like this,
<?php
$user = JFactory::getUser();
$status = $user->guest;
if($status == 1):
?>
<form id="login-form" class="form-inline" method="post" action="/home">
<div class="topUser">
Name:
<input id="modlgn-username" class="TopinputReg" type="text" placeholder="User Name" tabindex="0" name="username" />
</div>
<div class="toppass">Password:
<input id="modlgn-passwd" class="TopinputReg" type="password" placeholder="Password" tabindex="0" name="password" pwfprops="," />
</div>
<div class="topsignin">
<input class="Signin" name="Submit" tabindex="0" type="submit" value="" />
</div>
<div class="topregister">
<input name="button" type="submit" class="Register" id="button" value="" />
</div>
<input type="hidden" value="com_users" name="option">
<input type="hidden" value="user.login" name="task">
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url', $this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
<?php else:
?>
<div class="topUser">Welcome Back!</div>
<div class="toppass">Enjoy you stay.</div>
<form id="login-form" class="form-vertical" method="post" action="/log-out">
<div class="topsignin">
<input class="Signout" type="submit" value="" name="Submit" />
<input type="hidden" value="com_users" name="option">
</div>
<input type="hidden" value="com_users" name="option">
<input type="hidden" value="user.logout" name="task">
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('logout_redirect_url', $this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
<div class="topregister">
<input name="button" type="submit" class="account" id="button" value="" />
</div>
<?php endif;?>