質問

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