$_POST - Problem mit IE und Opera

aggroman

Lt. Junior Grade
Registriert
Sep. 2008
Beiträge
449
Tagchen,
ich hab mir ein Formular zusammengeklickt und anstelle von type='submit' ein Image benommen in dieser Form:

input type = 'Image' name="neu" value="neu" src='bla bla' ...

das Problem ist, dass per Firefox und Chrome der Wert ganz normal übergeben wird. Im IE und Opera speichert er keinen Wert.
Ich weiss dass man anstelle von Image ein submit button nehmen kann und als background image das Imagefile, das kann aber nicht Sinn der Sache sein oder ?

also nochmal zusammengefasst:

<form action = "" method = "post">

<input type = 'Image' name="neu" value="neu" src=' ' />

</form>


if (isset($_POST['neu'])) {
echo "test"; -> FAIL
}
Ergänzung ()

Ok ist gelöst,
fucking IE
man muss neben dem Image auch noch ein hidden feld dazusenden also
<input type = 'hidden' name="neu" value="neu"/>
 
Eine Alternative wäre noch, das button Element anstatt dem input zu verwenden.
Darin kann beliebiger HTML Code (bis auf Verweise) notiert werden:

HTML:
<form>
<input type="text" name="name"/>
<!-- [...] -->
<button type="submit">
<img src="..." alt="..." />
</button>
</form>

/edit: Irgendwie funktioniert der HTML Code highlighter nicht richtig...
 
Zuletzt bearbeitet:
aggroman schrieb:
Tagchen,
ich hab mir ein Formular zusammengeklickt und anstelle von type='submit' ein Image benommen in dieser Form:

input type = 'Image' name="neu" value="neu" src='bla bla' ...

das Problem ist, dass per Firefox und Chrome der Wert ganz normal übergeben wird. Im IE und Opera speichert er keinen Wert.
Ich weiss dass man anstelle von Image ein submit button nehmen kann und als background image das Imagefile, das kann aber nicht Sinn der Sache sein oder ?

also nochmal zusammengefasst:

<form action = "" method = "post">

<input type = 'Image' name="neu" value="neu" src=' ' />

</form>


if (isset($_POST['neu'])) {
echo "test"; -> FAIL
}
Ergänzung ()

Ok ist gelöst,
fucking IE
man muss neben dem Image auch noch ein hidden feld dazusenden also
<input type = 'hidden' name="neu" value="neu"/>

Bevor du anfängst auf IE oder Opera zu schimpfen solltest du vorher mal die Spezifikation zu Rate ziehen:

When a pointing device is used to click on the image, the form is submitted and the click coordinates passed to the server. The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image. The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively.

Kurz übersetzt: Es werden "neu.x" und "neu.y" als Variablen submitted, und NICHT "neu".
 
Zurück
Oben