contra10 Posted March 5, 2009 Share Posted March 5, 2009 i tried too look at the problem but i don't know if its my php thats messing up once i put in an image as submit button <input type="image" name="submit" value="submit" src="cooltext414969221.png" onmouseover="this.src='cooltext414969221MouseOver.png';" onmouseout="this.src='cooltext414969221.png';"/></td></tr> </form> </table> <a href="http://localhost/eventfind/">Search by name</a> </center> </div> </div> <div class="meta">Results</div> <div class="storycontent"> <form action="" method="get" enctype="application/x-www-form-urlencoded"> <table height="20" width="450" border="0"id="results"> <tr><td>Results</td></tr> <?php // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //This code runs if the form has been submitted if(isset($_POST['submit']) and ($_POST['continent']) and ($_POST['country']) and ($_POST['state']) and ($_POST['eva']) and ($_POST['event'])) { ?> with a regular submit button it works but do i have to change my php so that it can work this way Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/ Share on other sites More sharing options...
phpdragon Posted March 5, 2009 Share Posted March 5, 2009 <form> and </form> should be either side of your submit button looks like the bottom bit of code before your php should be at the top also you need to put the onmouseover an onmouseout inside a style tag in you input button Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/#findComment-777036 Share on other sites More sharing options...
RussellReal Posted March 5, 2009 Share Posted March 5, 2009 you need an onclick event for the image button Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/#findComment-777037 Share on other sites More sharing options...
contra10 Posted March 5, 2009 Author Share Posted March 5, 2009 my code is like this <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" > <tr><td align="left" width="100"> <br> Continent: </td><td align="left"> <select name="continent" id="continent" onchange="setCountry();" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"> <option value="Africa">Africa</option> <option value="Asia">Asia</option> <option value="Europe">Europe</option> <option value="North America">North America</option> <option value="Oceania">Oceania</option> <option value="South America">South America</option> </select> </td></tr> <tr><td><br></td></tr> <tr><td align="left"> Country: </td> <td align="left"><select name="country" id="country" width="5" onchange="setStates();" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; width: 230px; background-color: #72A4D2;"> <option value="">Please select a country</option> </select> </td></tr> <tr><td><br></td></tr> <tr><td align="left"> State/Province:</td><td align="left"> <select name="state" id="state" onchange="setCities();" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"> <option value="">Please select a State/Province</option> </select> </td></tr> <tr><td><br></td></tr> <tr><td align="left"> City: </td> <td align="left"><input type="city" name="city" size="30" maxlength="50" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"> </td></tr> <br> <tr><td align="left"> <b>Category:</td> <td align="left"> <select name="eva" id="eva" onchange="setevent();"> <option value="" selected>Select an Option</option> <option value="arts">Arts</option> <option value="cause">Cause</option> <option value="cultural">Cultural</option> <option value="entertainment">Entertainment</option> <option value="education">Education</option> <option value="fashion">Fashion</option> <option value="justforfun">Just for Fun</option> <option value="outdoors">Outdoors</option> <option value="party">Party</option> <option value="political">Political</option> <option value="private">Private</option> <option value="sport">Sport</option> <option value="cause">Other</option> </select> <select name="event" id="event" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"> <option value=""></option> </select> </td></tr> <tr><td> <input type="image" name="submit" value="submit" src="cooltext414969221.png" onclick="submit" onmouseover="this.src='cooltext414969221MouseOver.png';" onmouseout="this.src='cooltext414969221.png';"/></td></tr> </form> </table> <a href="http://localhost/eventfind/">Search by name</a> </center> </div> </div> <div class="meta">Results</div> <div class="storycontent"> <form action="" method="get" enctype="application/x-www-form-urlencoded"> <table height="20" width="450" border="0"id="results"> <tr><td>Results</td></tr> <?php // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //This code runs if the form has been submitted if(isset($_POST['submit']) and ($_POST['continent']) and ($_POST['country']) and ($_POST['state']) and ($_POST['eva']) and ($_POST['event'])) { ?> i have the form tags and i just tried onclick...doesn't really work, unless i did it wrong[/code] Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/#findComment-777040 Share on other sites More sharing options...
phpdragon Posted March 5, 2009 Share Posted March 5, 2009 you dont need onclick you need to put those events in a style tag for background_image and the back-ground image for hover Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/#findComment-777043 Share on other sites More sharing options...
contra10 Posted March 5, 2009 Author Share Posted March 5, 2009 not getting it...style tags as <style type="text/javascript"> </style> or just <style> </style> Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/#findComment-777051 Share on other sites More sharing options...
gevans Posted March 5, 2009 Share Posted March 5, 2009 not getting it...style tags as <style type="text/javascript"> </style> or just <style> </style> <style type="text/css"> input.submit:hover{different background image} </style> That should be a starting point, you need to add the class submit to the sumbit button. Though I dont' think this is why your form isn't working Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/#findComment-777134 Share on other sites More sharing options...
contra10 Posted March 5, 2009 Author Share Posted March 5, 2009 i was reading something that said i have to use x and y or something like that I have to use _ http://us3.php.net/manual/en/faq.html.php#faq.html.form-image Quote Link to comment https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/#findComment-777461 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.