简体   繁体   中英

PHP: input type button/submit not working to view the result when using an image

I have a button where it will display the playlist of a building...

Scenario 1: I tried the two types of button, the other one is image and the other one is button...

When I tried the to used the image type.

Here's the code:

echo "<input type='image'  src='image/view.png' name='viewResult[]' value='" . $row['fldBldgName']."' onClick=\"this.form.action='looptime_utilization_process_viewer.php'; this.form.submit()\"> ";

Its not displaying the correct output.. instead its display a number and I dont know where the program get it...I checked my database and there is no output like that...

Scenario 2: I tried the type button/submit and its display the correct output...

Here's the code:

echo "<input type='submit'  name='viewResult[]' value='" . $row['fldBldgName']."' onClick=\"this.form.action='looptime_utilization_process_viewer.php'; this.form.submit()\"> ";

Here's the sample output I want:

The result of that output is the scenario one....I also tried the background image in button but I don't like that.

An input type="image" only defines that image as the submit button and not as an input that can carry over a value to the server.

So you can't use type'image' to carry a value, However you could do this: <input type="text" value="data to carry to server"> <br><input type="image" src="image/view.png" name="viewResult[]">

So by adding to inputs together the the first input can carry your data while the image submits the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM