I am creating multiple uploading page using PHP, but canät get it to work. This is my form code with Lightbox:
<div id="lightBox">
<div id="lightWrap">
<div id="closeBox">X</div>
<button class="prev">Previous</button>
<button class="next">Next</button>
<div id="my_div"></div>
<?php echo "<div id='divlists'>".$rows."</div>";?>
<p><span class="login_label">Djname</span>
<span class="login_input">
<form action="GET" method="" name="lightbox" >
<input type="text" name="name<?php echo $rows; ?>[]" id="name<?php echo $rows; ?>[]" ></form></span></p>
<div style="clear: both;"></div>
<p>
<span class="login_label">Music topic</span>
<span class="login_input">
<form name="light">
<input type="text" name="topic<?php echo $rows; ?>[]" id="topic<?php echo $rows; ?>[]">
</form>
</p>
<input type="image" class="search_form" value="Refresh" src="Save2.png" alt="Submit" id="file_upload_start" onclick="开发者_开发技巧login()"/>
<input type="button" name="get_value" id="get_value" value="Get Value!!!" />
</span>
</div>
</div>
<div id="fade"></div>
Uhm, don't know if due to several typos or what, but your html has some errors in it... First, you switched method and action, it should be
<form action="" method="GET" name="lightbox">
'action' would be the processor of the form, if empty the same page will be loaded, else use another file for that.
I don't know what you mean by <form name="light">
? Are you opening another form?
I suggest you use just one form, using fieldsets to separate content, if that's what you intended to do. Two forms just add complexity when retrieving values, for such few fiels I see it a bit ovrehead.
Then, use a <input type="submit"....>
to submit values.
And, also, those buttons are outside the forms (any of the two), that could be a problem (but am not 100& sure about it, I just go by experience and logic, please correct me if I'm wrong)
Moreover, the input fields don't have a value, so nothing can be read from theme. And I'm not sure what are you trying to achieve with name="name[]". How's $row
supposed to be? it should be a single string value, so those brackets are not right there (usually you have them when building groups, e.g. in radio button or multiselect checkbox).
To access these fields you then need to get the corresponding index of the $_POST array, where the index is the 'name' element of the input field.
Correct the markup and see if the problems rises again!
Check this resource on php forms to get a better grasp of how it should work.
精彩评论