Jump to content

help me organizing the script


nochlux

Recommended Posts

the script works, but I wanted to simplify the code if possible!

 

<div id="bottom">

 

 

<img src="test.png" id="test" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;">
 

<img src="test.png" id="test2" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;">

 

 

 

 

<map name="test">
 
<form method="post" target ="top>
<area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000">
 

</map>

 

 

<map name="test2">
 
<form method="post" target ="top>
<area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000">
 

</map>

 

</form>

</div>

 

 

now on my php pg,

 

i have this

 

if(!empty($_GET['id']))

{

 

$id=$_GET['id']

}

 

 

if I write this script and run, it works when I use get, but it will not when I replace it POST.

How can i fix the html page, for div, form, and map?

 

Thank you

 

 

 

 

Link to comment
Share on other sites

If you send POST data to the server, use $_POST - similarly if you send GET data use $_GET

 

Currently you're posting and using $_GET within your script which will just fail.

Link to comment
Share on other sites

To the best of my knowledge, an AREA tag does NOT submit a FORM. It is basically an A (anchor) tag that opens a new resource (with a GET request). You have not defined any fields in the FORM tags, so I'm wondering what you are trying to POST? Even when you POST a form, anything in the url after the "?" becomes a GET element, only fields defined in the FORM become POST elements.

 

Here is the code you posted, I just reformatted it a bit -- please use the

...

tags for posting code (it's the <> button on the toolbar)

 

<div id="bottom">
  <img src="test.png" id="test" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;">
  <img src="test.png" id="test2" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;">

  <map name="test">
    <form method="post" target ="top>
    <area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000">
  </map>

  <map name="test2">
    <form method="post" target ="top>
    <area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000">
  </map>
    </form>
</div>
I've never used MAPs and AREAs, but from what I've read about them, I don't see how this code could "work" at all.

 

1. Both of your images refer to the same MAP, and that MAP ("testmap") does not exist

2. Both images have width and height of zero and visibility hidden -- perhaps there is some JavaScript in play here?

3. The FORM tag inside the first MAP tag is never closed

4. The FORM tag inside the second MAP tag is closed outside of the MAP tag -- You should never overlap block-level tags.

5. There are no form fields in either form to be submitted

6. The coordinates in both AREA tags define a single-pixel region (that's going to be difficult to click on)

 

[edit]

7. Forms are submitted to the URL specified in the ACTION attribute of the FORM tag. If no ACTION attribute is specified it will submit to "itself" (the same URL as is displaying it).

[/edit]

Edited by DavidAM
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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