문제

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

도움이 되었습니까?

해결책

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?

다른 팁

Probably you're looking for type image:

<input name="addBal" type="image" src="pics/add.png" alt="Submit" />
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top