CodeIgniter Forums
Using image as a button in form_submit - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Using image as a button in form_submit (/showthread.php?tid=14339)



Using image as a button in form_submit - El Forum - 12-29-2008

[eluser]Bikun[/eluser]
Is there a way to do that?


Using image as a button in form_submit - El Forum - 12-29-2008

[eluser]thinkigniter[/eluser]
I Opened google typed "image as form submit"
click on the first page and...

Code:
<INPUT TYPE="IMAGE" SRC="butup.gif" ALT="Submit button">

As a 'Web Developer' always try googling before you post as this will help develop your "Self Help Skills".


Using image as a button in form_submit - El Forum - 12-29-2008

[eluser]Michael Wales[/eluser]
I think Bikun was specifically asking if there was a Form helper to do this - no there is not. You could easily create one and place it within your application's /helpers directory.

To be honest, I find the Form helper to be little help at all and only use the form_open() and form_close() tags myself.


Using image as a button in form_submit - El Forum - 12-29-2008

[eluser]Unknown[/eluser]
I never use the form helper... I find it to be more bother than it's worth.
Another option is to use the button element.
Code:
<button type="submit"><img src="/images/submit-button.gif" /></button>

And yeah, that can be found via Google as well.


Using image as a button in form_submit - El Forum - 12-30-2008

[eluser]Bikun[/eluser]
[quote author="Michael Wales" date="1230612002"]I think Bikun was specifically asking if there was a Form helper to do this - no there is not. You could easily create one and place it within your application's /helpers directory.

To be honest, I find the Form helper to be little help at all and only use the form_open() and form_close() tags myself.[/quote]
Yes, exactly.

Okay, will use usual way then ...

Thanks!


Using image as a button in form_submit - El Forum - 05-11-2010

[eluser]Unknown[/eluser]
I have this bit of code:

&lt;?=form_submit(array('name'=>'register',
'class'=>'submit',
'value'=> 'Submit' ))?&gt;

I'm I'm trying to replace the standard "Submit" with an image button.

Tips on how to rewrite this such that I can include an image???

Thanks.


Using image as a button in form_submit - El Forum - 08-31-2010

[eluser]Unknown[/eluser]
Instead of using form_submit button, use form_input and put in your image info
Code:
&lt;?php
                echo form_open("home/search");
                $searchterm = array(
                    "name" => "term",
                    "id" => "term",
                    "maxlength" => "64",
                    "size" => "15"
                );
                $btn_search = array(
                    'type'      => 'image',
                    'src'        => base_url().'images/site/btn_search.gif',
                    'name'        => 'image',
                    'width'     => '27',
                    'height'    => '22',
                    'value'        => ''
                    
                );

                echo form_input($searchterm);
                echo form_input($btn_search);
                echo form_close();



Using image as a button in form_submit - El Forum - 06-04-2012

[eluser]Unknown[/eluser]
Hi, I know this post is 2 years old but I thought I'd add what I did (maybe someone can correct it if I'm not doing this right as I'm new to CI)...

Basically I put the image as a background in the CSS and did the following in the loginform.php
Code:
&lt;?php
$property_type = array('class' => 'form-submit', 'src="'.base_url().'"/application/_images/login-btn.png"', 'name' => 'Login'); echo form_submit($property_type); ?&gt;

?&gt;

Did I just fluke out getting this to work? I don't know but it does exactly what I need it to do.