i am designing a login page using html and php.it includes two buttons one for login and another one to redirect to the registration page.i am planning to use php code to validate login data on the same page.here is my code
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<div>
<table style="width: 100%; height: 377px;">
<tr>
<td rowspan="4"><img src="woman.jpg" height="100%" width="100%" alt="woman"/></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="right" style="padding:0px;color:white" >username:</td>
<td><input runat="server" name="Text1" type="text" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="right" style="padding:0px;color:white">password</td>
<td><input runat="server" name="Text2" type="text" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td></td>
<td ><input name="Submit1" type="submit" value="login" />
<input onclick="document.location.href='regforswa.php'" name="Submit2" type="submit" value="register" /><br/>
forgot password</td>
</tr>
</table>
</div>
</form>
but the button for registration is not working properly.it is not redirecting to the registration page.i don't want to put register button outside the form.i want to keep the same design and achieve required functionality.
Change the Button-Type from type="submit" to type="button" to disable the form submission:
<input onclick="document.location.href='regforswa.php'" name="Submit2" type="button" value="register" />
Related
I have five textboxes on the same webpage for five different MySQL queries. I need this because the text in the textbox is different and depend on the MySQL query that I need to do.
May I use a drop down menu or radio button to select different textbox and so to select different MySQL query to execute?
Here is my code:
<table border="1" bgcolor="#FFFFFF">
<tr>
<td align="left">Query per office</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="drawsiti_query_output.php">
<tr>
<td></td>
<td>
<input type="text" name="ufficio" size="20">
</td>
<td align="right"><input type="submit" name="submit" value="Esegui"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<p></p>
<table border="1" bgcolor="#6e00ff">
<tr>
<td align="left">Query per nome</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="drawsiti_query_output_nomesito.php">
<tr>
<td></td>
<td>
<input type="text" name="nomesito" size="20">
</td>
<td align="right"><input type="submit" name="submit" value="Esegui"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<p></p>
<table border="1" bgcolor="#ff0000">
<tr>
<td align="left">Query per codice 2g</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="drawsiti_query_output_2g.php">
<tr>
<td></td>
<td>
<input type="text" name="codice2g" size="20">
</td>
<td align="right"><input type="submit" name="submit" value="Esegui"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<p></p>
<table border="1" bgcolor="#00c2ff">
<tr>
<td align="left">Query per codice 3g</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="drawsiti_query_output_3g.php">
<tr>
<td></td>
<td>
<input type="text" name="codice3g" size="20">
</td>
<td align="right"><input type="submit" name="submit" value="Esegui"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<p></p>
<table border="1" bgcolor="#06fc00">
<tr>
<td align="left">Query per codice 4g</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="drawsiti_query_output_4g.php">
<tr>
<td></td>
<td>
<input type="text" name="codice4g" size="20">
</td>
<td align="right"><input type="submit" name="submit" value="Esegui"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<p></p>
<table border="1" bgcolor="#f100ff">
<tr>
<td align="left">Query per office -> output cell</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="drawsiti_query_output_cell.php">
<tr>
<td></td>
<td>
<input type="text" name="ufficio" size="20">
</td>
<td align="right"><input type="submit" name="submit" value="Esegui"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
You can change input name or form action by select. (or together)
<select>
<option value="ufficio">ufficio</option>
..
</select>
<input type="text" id="inp" name=""/>
<script>
$('select').change(function(){
$('#inp').attr('name', $(this).val());
});
</script>
I have this form:
<div class="page3">
<form id="indexform" action="index.php" method="post">
<table class="datatable2" style="padding:20;" >
<tr>
<td><center>Username </center><input type="text" name="name" value="" size="10" /></td>
</tr>
<tr>
<td><center>Password </center><input type="password" name="password" value="" size="10" /></td>
</tr>
<tr>
<td colspan="2" class="datatable2" style="padding:55 0 0 38;">
<input type="submit" value="Log In" name="admsubmit" class="subbtn" style="background-image: url(imagini/autentificare.png);background-repeat:no-repeat;background-position:10 5;background-size:17px;"/></form>
</td>
<tr>
<td colspan="2" class="datatable2" style="padding:40 0 0 8;">
<form action="parola_uitata.php"> <input type="submit" align="right" value="Ai uitat parola?" class="subbtn" style="background-image: url(imagini/parola_uitata.png);background-position:11;background-repeat:no-repeat;background-size:17px;margin:-45 1;padding-left:30;" name="parola_uitata"></form>
</td>
</tr>
</table>
</div>
IMAGE:
and i want to know how i can hide after logging, and only displaying in same div some like : Hello ($_SESSION['user']) -- go to admin panel. If someone can give me some idea it would be helpful me.
Wrap an if statement around your markup, and display based on the state of the session (if they are logged in or not)
<div class="page3">
<?php if(!isset($_SESSION['logged_in'])) : ?>
<form id="indexform" action="index.php" method="post">
<table class="datatable2" style="padding:20;" >
<tr>
<td><center>Username</center><input type="text" name="name" value="" size="10" /></td>
</tr>
<tr>
<td><center>Password </center><input type="password" name="password" value="" size="10" /></td>
</tr>
<tr>
<td colspan="2" class="datatable2" style="padding:55 0 0 38;">
<input type="submit" value="Log In" name="admsubmit" class="subbtn" style="background-image: url(imagini/autentificare.png);background-repeat:no-repeat;background-position:10 5;background-size:17px;"/></form>
</td>
<tr>
<td colspan="2" class="datatable2" style="padding:40 0 0 8;">
<form action="parola_uitata.php"> <input type="submit" align="right" value="Ai uitat parola?" class="subbtn" style="background-image: url(imagini/parola_uitata.png);background-position:11;background-repeat:no-repeat;background-size:17px;margin:-45 1;padding-left:30;" name="parola_uitata">
</form>
</td>
</tr>
</table>
<?php else : ?>
<-- User logged in, show control panel stuff !-->
<?php endif; ?>
</div>
Lets says that I have form and in the end I have 2 buttons
1 - send test form
2 - send live form
both send the same form. How can I send parameter to the server so I will know if its test or live?
Thanks
<form method='post' action='index.php?page=mailing&campID=<?PHP echo $_GET['campID'] ?>&act=<?PHP echo $actType ?>' id="Form" >
<table class="sort">
<tr>
<td>email address</td>
<td><input type="text" name="emailTest" value="<?PHP echo $user_details['email'] ?>" /></td>
</tr>
<tr>
<td></td>
<td>send test</td>
<td>send live</td>
</tr>
</table>
</form>
Just check in php if 'submit' field is 'test' or 'live'.
<form method='post' action='' id="Form" >
<table class="sort">
<tr>
<td>email address</td>
<td><input type="text" name="emailTest" value="" /></td>
</tr>
<tr>
<td></td>
<td><button type="submit" name="submit" value="test">Test</button></td>
<td><button type="submit" name="submit" value="live">Live</button></td>
</tr>
</table>
</form>
You'll either need to use JS, or one submit button, and a radio button. The latter is a better option, as you can't accidentally submit something to the wrong queue. Also, you should really be using a submit button, not an anchor.
The reason I would prefer the radio buttons is because once you click submit, you're past the point of no return. The radio button allows you to to click the wrong one, and then change it.
input[type="submit"] {
background: none;
border: 0;
color: blue;
text-decoration: underline;
cursor: pointer;
}
<form method='post' action='' id="Form">
<table class="sort">
<tr>
<td>email address</td>
<td>
<input type="text" name="emailTest" value="" />
</td>
</tr>
<tr>
<td>
<input type="radio" name="testLive" value="test" id="test" />
<label for="test">Submit as Test</label>
</td>
<td>
<input type="radio" name="testLive" value="live" id="live" />
<label for="live">Submit as Live</label>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit" />
</td>
</tr>
</table>
</form>
I have a form like this
<form id= 'frm_request'>
<table class="opt_tbl1" align="center">
<tr>
<td><strong>TLD No.</strong></td>
<td colspan="2"><input type="text" id="tldno" name="tldno" size="25" maxlength="25" />
</td> </tr>
<tr > <td><strong>Name of Worker</strong></td>
<td colspan="2"><input type="text" id="fname" name="fname" size=50 maxlength=50 /></td>
</tr>
<tr>
<td ><strong>Date of Birth (Optional)</strong></td>
<td ><input id="new_day" name="dateofbirth" type="text" />
<tr>
<td colspan="3" align="center"><br/>
<input type="submit" name="_btn" value="Submit" action=""/></td>
</tr>
</table>
</form>
When the focus moves from input box “tldno”, the input “fname” to be filled by getting the html from another domain which I have no control. The html in the other domain, is like this:
<body>
<form method="POST" name="form1" action="../dbms/allindvres.asp" target="I1">
<table >
<tr>
<td width="33%" height="22" align="middle" ><font size=4>TLD No <input name="TLDNO" size="10"></td>
<td width="33%" height="22" align="middle" ><font size=4>CC No <input name="CCNO" size="10"></td>
<td width="33%" height="22" align="middle"><font size=4>or Name <input name="name" size="30"></td>
<td width="33%" height="22" align="middle">
<p align="center">< <input type="submit" value="Get Life Dose" name="B1"></p>
</td>
</tr>
</table>
</form>
<iframe name="I1" >
Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></p></p>
</body>
Upon submitting the above form, the result will be displayed in the iframe. I want the whole html in my page so that I can scrap traverse through the html to get the name of the tldno holder and display it in my input box. Kindly help me to write an ajax call that will return this html
$("#tldno").blur(function(e){
// ajax POST call to the URL http://10.40.64.100/dbms/allindvres.asp with parameter tldno
//Get html
//do something with this html – This part I know.
});
Can any one help with the above method or suggest alternate methods?
Two important points in this question is, (1) I do not have control on the other domain. (2) the URL on the other domain accepts only POST not GET
I do not know why the submit button doesn't work. When I click on it, nothing happens.
What is What is Mistake don't know?
Here is code:
<form action=members.php method=post>
<br><br><Center><table><tr><td colspan=2 align=center><h3>Members Login Area</h3></td></tr>
<tr><td>Member's ID</td><td><input type=text name=id></td></tr>
<tr><td>Password</td><td><input type=password name=password></td></tr>
<tr><td> </td><td>
<font face="Verdana,Arial,Helvetica" size="1" color="#000000"><b>Forgot Your Password?</b></font></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Log In"></td></tr>
</table></form>
where is quotes ("). u missed quotes everywhere :P
<form action="members.php" method="post">
// Your code must be something like this.
<form action="members.php" method="post">
<br><br>
<center>
<table>
<tr>
<td colspan="2" align="center">
<h3>
Members Login Area
</h3>
</td>
</tr>
<tr>
<td>
Member's ID
</td>
<td>
<input type="text" name="id"></td>
</tr>
<tr>
<td>
Password
</td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td>
</td>
<td>
<a href="forgot.php" onclick="doexit=false;">
<font face="Verdana,Arial,Helvetica" size="1" color="#000000">
<b>
Forgot Your Password?
</b>
</font>
</a>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Log In">
</td>
</tr>
</table>
</center>
</form>
<input type=submit value="Log In">
should be
<input type='submit' value="Log In">
and its like type="something" not type=something
the structure of input is
<input type='keyword' > and keyword could be from this list (w3.org)