Jump to content

isset question


leachus2002

Recommended Posts

Hi Everyone,

 

I am a great fan of the 'isset' function, which I use alot when submitting forms, but not wanting to navigate away from the page. Normally I just use a form with a submit button with a name, for example:

 

<input type='submit' name='updatetable' value='Go!'/>

 

and then use the following:

 

<?php if (isset ($_POST['updatetable'])) { do this stuff... } ?>

 

But I want to start to use images as submit buttons, so when you click on them, you are able to submit the underlying data. Is there a way to do this using the isset function? Because effectively, the image, which would submit using javascript, wont have a name.

 

Any ideas appreciated

 

Many Thanks

Matt

Link to comment
Share on other sites

use css style to change how your button looks:

<input type="submit" name="updatetable" value="" style="background-image:url(your_image.jpg); width:50px; height:50px;" />

and then handle it like you have it:

<?php if (isset ($_POST['updatetable'])) { do this stuff... } ?>

Link to comment
Share on other sites

If you dont have your button text merged into your button image you just need to specify value for the button:

<input type="submit" src="image.jpg" value="My button text">

 

You can also use CSS to load the image and to enhance your button text as solon said.

Link to comment
Share on other sites

Solon,

 

Here is the code:

 

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>

<body>
<input type="submit" name="updatetable" value="" style="background-image:url(flexierror.jpg); width:50px; height:50px;" />
</body>

</html>

 

As you can see, just cut and pasted. Further to these comments, I have tried Firefox and its ok (ish) - however IE still isnt.

 

Cheers

Matt

Link to comment
Share on other sites

Hi leachus2002,

 

I got the same problem, it was to use an image exactly as an submit button. Following solved my problem. Give it a try...

<?php 
    if (isset($_POST['picButton'])){
        /* Hit the goal using the 'value' parameter */                     
    }
?>

It was as usual. Down here the input type is set as 'image' instead of 'submit'. It'll do the trick..

<input type="image" name="picButton" value="first" src="/images/arrow.jpg"/>

May have to adjust width height etc. using styles.  8)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.