Help replacing button in form with gif

oh wise ones,

syntax challenged hack needs a little education please…

want to replace this lame button with a nice little pic of a calendar, but having much difficulty.

here’s the whole form:
echo ‘<form method=“post” id=“gotoD” name=“gotoD” action="index.php?cP=’.$cP.‘&cC=’.$cC.“\”>
$newDate = IDtoDD($cD);
echo $xx[“hdr_go_to”].': ';
echo '<input class=“input” type=“text” name=“newDate” id=“newDate” value=”‘.$newDate.“\” size=‘10’ />
echo '<input class=“button” type=“button” title=”’.$xx[“hdr_select_date”].“\” value=\“…\” onclick=\“dPicker(‘gotoD’,‘newDate’)\” />
echo "</form>

shouldn’t it be as simple as this: (no laughing please)
echo ‘<input class=“button” type=“button” title="’.$xx[“hdr_select_date”].“\” value=\“<img src=“images/calendar.gif” alt=“Select Date” />\” onclick=\“dPicker(‘gotoD’,‘newDate’)\” />

but changing class and type to ???

like I said I struggle with syntax and would really appreciate a push in the right direction please.


I just plugged in RAJU’s code and all is well ! :slight_smile:
thanks for the help guys. saved me a couple of hours hair pulling!

If I have understood the actual problem, you can simply put that onclick function with simple img tag like this:

echo '<input class="button" type="image" src="images/calendar.gif" onclick="dPicker(\\'gotoD\\',\\'newDate\\');return false;" />' . "\

or you can have an INPUT element with IMAGE type as follows but this button will submit the form so dont forget to return false or do something else to prevent submitting the form:

echo '<input class="button" type="image" src="images/calendar.gif" onclick="dPicker(\\'gotoD\\',\\'newDate\\');return false;" />' . "\

I haven’t tested but you can do something like that above.

You need to use an input with a type of image:
<input type=“image” src=“pic.jpg” alt=“Submit”>

THis is more of a PHP question but I’ll try to help.

For one thing, what does the browser generate as HTML when you run that code? Got a site ? Where is the $xx array variable created?

I’ll request for a move since this doesn’t belong here :slight_smile: