rajmohan Posted November 16, 2006 Share Posted November 16, 2006 Hai guys i am facing login page problem situation is username, password and image <form name="form1" id="form1" method="post" action=""><table width="200" border="0" align="center" cellpadding="0" cellspacing="6"> <tr> <td width="85" class="fontPink style2">Username</td> <td width="115"><input name="username" type="text" class="fontBlack" id="username"></td> </tr> <tr> <td class="fontPink style2">Password</td> <td><input name="password" type="password" class="fontBlack"></td> </tr> </table> <div align="center"><img src="images/SignIn.jpg" alt="Click to Sign in" width="95" height="35" name="Submit"></div> </form>How to get values from this one. I know how to get this values if i use button. but here it is img. how to get values. Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/ Share on other sites More sharing options...
JasonLewis Posted November 16, 2006 Share Posted November 16, 2006 well first you havn't specified an action in your <form> tag. i would suggest specifying an action. next. to make an image you could do the following:1. make a button and use CSS to set a background image.or2. make an onclick in your <img> tag which i think should work..here is how to do #2.[code]<img src="images/SignIn.jpg" alt="Click to Sign in" width="95" height="35" name="Submit" onclick="document.form1.submit">[/code]give it a burl, otherwise i'd go with method one. which is what i'd do anyway. Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125415 Share on other sites More sharing options...
rajmohan Posted November 16, 2006 Author Share Posted November 16, 2006 i am doing validation in the same page i am not able to get value for my query$getusername = $_POST['username'];$password = $_POST['password'];$query =// query here;if(true){ // redirect page}else{ print "Wrong user";} Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125418 Share on other sites More sharing options...
JasonLewis Posted November 16, 2006 Share Posted November 16, 2006 well i would try changing it to a submit button.[code]<input type="submit" name="Submit" value="" style="background-image: url('images/SignIn.jpg'); border: 0; margin: 0; padding: 0; width: 95; height: 35">[/code] Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125423 Share on other sites More sharing options...
rajmohan Posted November 16, 2006 Author Share Posted November 16, 2006 yes it page is submitting i am validation in same pagehow to check it that is if(isset($_POST[' '])){ here i want to get values and check query in the same page}how to do Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125429 Share on other sites More sharing options...
JasonLewis Posted November 16, 2006 Share Posted November 16, 2006 you would go like this:[code]if(isset($_POST['Submit'])){ //Submit was the name of our submit button.//run your queries etc in here.}else{?>Show HTML form etc.<?php} //ends the if statement?>[/code] Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125431 Share on other sites More sharing options...
chiprivers Posted November 16, 2006 Share Posted November 16, 2006 To make the image submit the form, why dont you use:<input type="image" name="submit" src="images/SignIn.jpg"> Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125436 Share on other sites More sharing options...
rajmohan Posted November 16, 2006 Author Share Posted November 16, 2006 No it is not working yet i am not getting the values chiprivers Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125439 Share on other sites More sharing options...
chiprivers Posted November 16, 2006 Share Posted November 16, 2006 Could you explain exactly what you are trying to accomplish and post the full script here. Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125440 Share on other sites More sharing options...
rajmohan Posted November 16, 2006 Author Share Posted November 16, 2006 see the first post what i submittedin that form i am going to get username and password in the same page using one image if the user enter the username and password he has to click the image it should be taken asif(isset($_POST['Submit'])){ validation here if it is correct it should redirectelse error in username and password} Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125442 Share on other sites More sharing options...
chiprivers Posted November 16, 2006 Share Posted November 16, 2006 When you say validate the submitted details, do you mean query the database and ensure there is a correct record? Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125443 Share on other sites More sharing options...
rajmohan Posted November 16, 2006 Author Share Posted November 16, 2006 yes query validation and redirecting if it is correct Link to comment https://forums.phpfreaks.com/topic/27421-login-page-problem-look-here/#findComment-125448 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.