Jump to content

[SOLVED] php and image buttons


contra10

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/148039-solved-php-and-image-buttons/
Share on other sites

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]

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.