Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP - sending a variable with image button

Posted on 2006-07-23
5
Medium Priority
?
199 Views
Last Modified: 2010-04-17
I have a button but I want to use it to send a variable to the same page if it is pressed

<a  href="#"
onmouseover="document.sub_but1.src='buttons/reset_cream_over.gif'"
onmouseout="document.sub_but1.src='buttons/reset_cream_up.gif'"><img  src="buttons/reset_cream_up.gif"
alt="Move your mouse over me" name="sub_but1" width="82" height="32" border="0" align="absmiddle" id="sub_but1" /></a>

at the top I want to do something like

if (isset($_POST['reset']) {

//do something here

}


any ideas?

0
Comment
Question by:roscoeh23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 25

Accepted Solution

by:
InteractiveMind earned 1000 total points
ID: 17163635
If you wish to submit data to the same page (or any other for that matter), then I believe you need to use a submit button, rather than an anchor.


<?php

   if ( isset( $_POST['reset'] ) )
   {
      // do something
   } else
   {
      <form action="#" type="POST">
         // create some input fields here...
         
         <input type="submit">
      </form>
   }

?>


Does that help?
0
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 17163640
To make that an Image submit button, see here:

http://www.codetoad.com/html/buttons/image_submit_button.asp?x=75&y=19
0
 

Assisted Solution

by:mario_ccs
mario_ccs earned 1000 total points
ID: 17215830
Change the <a  href="#"

to

<a  href="your_page.php?variable=value"

then

if (isset($_GET['variable']) {

//do something here

}
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question