Help: Simple html/php button....

Discussion in 'HTML & Website Design' started by Skillman13, Jan 21, 2010.

  1. #1
    I have a button, I want it to echo something after it is clicked...

    I have this (example echo/code)...

    <form method="post" action="">
    <input src="delete.png" name="delete" type="image" value="delete" >
    </form>
    <?

    if(!empty($_POST['delete'])) {

    echo "Hi";

    }

    ?>



    I run this on firefox and it works, -Echos 'Hi'...

    I run this on IE and it doesnt work, -it refreshes the page, but no 'Hi' is loaded, how come?

    Please can anyone fix this?

    Thanks...

    James
     
    Skillman13, Jan 21, 2010 IP
  2. ryandanielt

    ryandanielt Well-Known Member

    Messages:
    1,797
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Okay a lesson to you in PHP, but I suggest that you post in the PHP section from now on!

    Your code does nothing!!!!

    Try this out!

    
    
    <form method="post" action="yourpagename.php" name="Test Script"> 
         <input type="image" src="delete.png" name="Submit" value="Submit">
    </form>
    
    
    HTML:
    
    
    <?PHP
    if(isset($_POST['Submit'])) {
    
       echo "Hi!";
    
    }
    ?>
    
    
    PHP:

    Try that and see if you get what it is you are trying to do!
     
    Last edited: Jan 22, 2010
    ryandanielt, Jan 22, 2010 IP
  3. kipdlid

    kipdlid Member

    Messages:
    144
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #3
    php is server based so it wont work without refreshing the page... Use ajax
     
    kipdlid, Jan 22, 2010 IP