Harsha M V
Harsha M V

Reputation: 54949

CakePHP submit button Image

I am trying to use image for a submit button

<?php echo $this->Form->submit('/img/prelaunch/btn_signup.gif'); ?>

thats the code i am using. but the image is not able to load The image is present in the following directory

Webroot/img/prelaunch/

**Updated**

HTML Generated

<div class="submit">
<input type="image" src="/ginger/img/prelaunch/btn_signup.gif">
</div>

Webiste Base URL http://bakasura.in/ginger/

URL http://bakasura.in/ginger/users/signup

Image URL http://bakasura.in/ginger/img/prelaunch/btn_signup.jpg

Upvotes: 3

Views: 10133

Answers (4)

zzirGrizz
zzirGrizz

Reputation: 1

I created a custom button using an image in my under app/webroot/img that uses inline style for specifying size and changing the position to center

$options=array('type'=>'Make secure payment', 'type'=>'image', 'style'=>'width:200px; height:80px; display:block; margin-left:auto; margin-right:auto;');
echo $this->Form->submit('/img/axiaepaysecurebuttongray_med.png', $options);
echo $this->Form->end();

Upvotes: 0

wetwebwork
wetwebwork

Reputation: 43

Another solution is:

<?php echo $form->submit('Sign up', array('type'=>'image','src' => '/img/prelaunch/btn_signup.gif'));  ?>

from: http://php-freelancer.in/2010/04/28/cakephp-how-to-make-image-submit-button/

Upvotes: 3

user314430
user314430

Reputation:

Just create a class name in css and add the image

Form->submit('submit',array('class'=>'show-image')); ?>

CSS

.show-image{ background-image:url(../img/prelaunch/btn_signup.gif); background-repeat:no-repeat; display:block; width:30px; height:30pxtext-transform:capitalize; }

Upvotes: 1

mark-cs
mark-cs

Reputation: 4707

The image is a jpg, you have put a gif in the submit button source code. Simple mistake :D

Upvotes: 4

Related Questions