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
https://forums.phpfreaks.com/topic/221848-isset-question/
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
https://forums.phpfreaks.com/topic/221848-isset-question/#findComment-1148041
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
https://forums.phpfreaks.com/topic/221848-isset-question/#findComment-1148079
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
https://forums.phpfreaks.com/topic/221848-isset-question/#findComment-1148108
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
https://forums.phpfreaks.com/topic/221848-isset-question/#findComment-1148242
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.