CakePHP : How To Make Image Submit Button

Posted by Ankur in CakePHP



Hello Friends, CakePHP having form helper to make text box,forms ad any other HTML input, But today I want to make a image work as submit button because one of my submit button in project using image, So I want to submit form when anyone click on image button, I have tried to search on internet about it that how can we make a image submit button and didn’t get any proper solution, Finally I tried it myself and got solution for it. I don’t know it is correct solution but it is working perfectly for me.

<?php echo $form->submit('', array('type'=>'image','src' => 'img/buttons/buynow.gif'));  ?>

In Above code just replace ‘img/buttons/buynow.gif’ with your image path. It will show image and working as submit button.

Let me know if you have any problem in this.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

  • Anuj

    Simple type image address inside submit function like $form->submit('image.jpg');

  • guest

    nice, but a question if you click this image(button) what will happen (what will be submitted)?

Get Adobe Flash player