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. Quote Link to comment 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. Quote Link to comment 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";} Quote Link to comment 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] Quote Link to comment 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 Quote Link to comment 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] Quote Link to comment 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"> Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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} Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.