Finding x,y co-ordinates on image button click problem

Discussion in 'PHP' started by midnight123, Sep 23, 2007.

  1. #1
    Hello.I copied this tutorial:
    http://www.plus2net.com/php_tutorial/php_image_coordinates.php

    It works fine on they're website but on my computer I
    get these errors:
    Notice: Undefined index: foo in C:\Program Files\EasyPHP 2.0b1\www\cord.php on line 3

    Notice: Undefined variable: foo_x in C:\Program Files\EasyPHP 2.0b1\www\cord.php on line 5


    Notice: Undefined variable: foo_y in C:\Program Files\EasyPHP 2.0b1\www\cord.php on line 7

    It doesn't seem to be recognizing the
    input image "Foo"

    
    <html><body>
    <form action='cord.php' method=post>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input 
    
    type="image" alt=' Finding coordinates of an image' src="xy-coordinates.jpg" 
    
    name="foo" id="foo"/>
    </form>
    </body></html>
    
    Code (markup):

    
    <html><body><center>Hello</center><br>
    <?php
    $foo=$_POST["foo"];
    
    echo($foo_x);
    echo("<br>");
    echo($foo_y); 
    ?>
    </body></html>
    
    Code (markup):
    Does Anybody know what the problem is?
     
    midnight123, Sep 23, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    $_POST['foo_x'];
     
    krt, Sep 23, 2007 IP
  3. sea otter

    sea otter Peon

    Messages:
    250
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use

    
    $foo_x = $_POST['foo_x'];
    $foo_y = $_POST['foo_y'];
    
    Code (markup):
    beaten by krt :)
     
    sea otter, Sep 23, 2007 IP
  4. midnight123

    midnight123 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks.That's it.Of course I have the evil register globals
    turned off.As they should be for everybody.
     
    midnight123, Sep 24, 2007 IP