I want to use images for submit buttons but there are like 6 of them. Each link leads to a section of code inside the same page. Here is the code for the page -
[Edited by Hartmann on 11-01-2000 at 11:38 AM]Code:<? $connection = mysql_pconnect("localhost","root","") or die("Couldn't connect to DB"); mysql_select_db("abraham",$connection) or die("Couldn't select DB"); $select = "SELECT username, password FROM users WHERE username='$username' AND password='$password'"; $getnum = mysql_query($select,$connection); $number = mysql_num_rows($getnum); if($number == 1) { if($action == "info") { ?> <HTML> <HEAD> <TITLE>Info Form</TITLE> </HEAD> <BODY> <FORM action="infoform.php" method="post"> <P> Last Name: <input type="text" size="30" name="lastname"> <BR> First Name: <input type="text" size="30" name="firstname"> <BR> <input type="submit" value="SUBMIT"> </FORM> </Body> </HTML> <?} elseif($action == "education") {?> <HTML> <HEAD> <TITLE>Education Form</TITLE> </HEAD> <BODY> <form action="eduform.php" method="post"> High School: <input type="text" size="30" name="hschool"> <P> College: <input type="text" size="30" name="college"> <P> <input type="submit" value="SUBMIT"> </form> </body> </HTML> <?} else {?> <HTML> <HEAD> <TITLE>Forms</TITLE> </HEAD> <BODY> <H1>Forms</H1> <form action="<? $PHP_SELF ?>" method="post"> <input type="hidden" name="username" value="<? print $username ?>"> <input type="hidden" name="password" value="<? print $password ?>"> <? $info = "SELECT * FROM info WHERE username='$username'"; $information = mysql_query($info); $infoarray = mysql_fetch_array($information); $ssn = $infoarray["ssn"]; $LastName = $infoarray["LastName"]; $FirstName = $infoarray["FirstName"]; $Address1 = $infoarray["address1"]; $City = $infoarray["city"]; $State = $infoarray["state"]; $zip = $infoarray["zip"]; $hphone = $infoarray["hphone"]; $eligible = $infoarray["eligible"]; $felony = $infoarray["felony"]; if((!$ssn) || (!LastName) || (!FirstName) || (!Address1) || (!City) || (!State) || (!$zip) || (!hphone) || (!eligible) || (!felony)) { $link_image1 = "<input type=\"image\" src=\"personal_green.gif\" name=\"action\" value=\"info\">"; } else { $link_image1 = "blue"; } echo $link_image1; }?></form><? } else { echo "Not Authorized!"; } ?>




I thought you can use images to submit forms. But when I click the image it sends me back to the same page! I need a way to change the action of the button. Could I put each button in its own form?

Bookmarks