Pregunta

I can submit input with type "submit" but once I changed it to "image" it doesn't submit.

Works with submit:

<FORM ACTION="balance.php" METHOD="POST" enctype="multipart/form-data">
    <input name="addBal" type="submit"/>
    </form>

Doesn't work with image:

<FORM ACTION="balance.php" METHOD="POST" enctype="multipart/form-data">
    <input name="addBal" src="pics/add.png" type="image"/>
    </form>

Output end (balance.php):

if(isset($_POST['addBal'])) {
    echo 'TESTER';
}

I've made a typo: but the problem still remains. Type submit works, and image doesn't

¿Fue útil?

Solución

You can try this example:

<button type="submit" name="addBal" style="padding: 0; border: none;"><img src="monkeydluffy.png" /></button>

It can serve the same purpose of submitting. As for additional information, you can check out this discussion regarding your concern.

Input Type image submit form value?

Otros consejos

Probably you're looking for type image:

<input name="addBal" type="image" src="pics/add.png" alt="Submit" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top