How to submit buttons via textboxs array

时间:2015-09-01 21:36:22

标签: javascript php button textbox submit

I want to create a page with about 300 textboxs from a foreach loop. I am able to write links into the textboxes, but i can't read textboxes array. Buttons are not working. How to submit these links via buttons?

echo "<form><input style='width:1000px' type='text' name='link[]' value='https://example.com/api/user_api.php?request=SellItem&amount=" . $number . "&featured=0&classid=" . $item["classid"] . "&instanceid=" . $item["instanceid"] . "&key=xxx'". "<br>";
echo "<input name='Launchlink[]' type='button' value='Send' onclick='location.href=this.form.elements['link[]'].value'></form>'";

1 个答案:

答案 0 :(得分:1)

In light of your comments

var links = <?=json_encode($the_link_array)?>;
function open_all_of_the_links(){
    for (var i = 0; i < links.length; ++i) {
        window.open(links[i], "_blank");
    }
}
document.getElementById("theButton").addEventListener("click", open_all_of_the_links);

And then you can have anything with an ID of "theButton" and that'll register an event on it and should open all of the URLs in new tabs.

<span id="theButton">Click here to make all of your dreams come true</span>