SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    819
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question Changing Submit Button Type to 'Image', PHP Form Not Working

    I have a image button that I would like to use, but when I changed my form button type to image, my PHP form will not process:

    PHP Code:
    <?php if (array_key_exists('gotoreview'$_POST)) {
        echo 
    'you click the gotoreview button';
    }
    ?>
    HTML Code:
    <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <p style="font-weight: normal"><input type="image" name="gotoreview" id="gotoreview" alt="" style="float: right; margin-right: 3px" src="http://www.sitepoint.com/forums/images/review-and-complete.png" height="33" width="135" />
    </form>
    Thanks for the help!

  2. #2
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this instead
    PHP Code:
    <?php if (isset($_POST['gotoreview_x'])) { 
        echo 
    'you click the gotoreview button'
    ?>
    It's an image, so you have to add _x to the end of the key.

    Edit: Your code will work too - just add _x to the end of the key.

  3. #3
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    819
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Great! That worked! Thank you.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •