Welcome Guest, Not a member yet? Register   Sign In
Using image as a button in form_submit
#1

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

[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".
#3

[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.
#4

[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.
#5

[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!
#6

[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.
#7

[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();
#8

[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.




Theme © iAndrew 2016 - Forum software by © MyBB