paulman888888 Posted August 7, 2008 Share Posted August 7, 2008 I have my form and the form changes everytime. The form may have 12 textareas or something 24. What I would like to know is how do i collect all data from all text area into 1 string? heres my form <?php //this is the important part for ($i=1; $i<=$moves; $i++)//the $moves will change all the time { echo'<tr><td width="50%"><span id="sprytextfield1"><label> '.$i.') <input name="white_move_'.$i.'" type="text" id="white_move_'.$i.'" size="9"></label> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Please Enter Whites Move.</span></span></td>'; echo'<td width="50%"><span id="sprytextfield2"> <label><input name="black_move_'.$i.'" type="text" id="black_move_'.$i.'" size="9"> </label> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Please Enter Blacks Move</span></span></td></tr>'; } On my collection page where all infomation is sent. How would i retieve all the form information? I would like to collect the results like this. (number). (value of white_move_#) (value of black_move_#) # will change all the time. I hope i didnt sound to confuseing. Thankyou Paul Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted August 7, 2008 Share Posted August 7, 2008 This is one way of doing it, however not very efficient. <?php $textareas = $_POST['textarea1'] . $_POST['textarea2'] . $_POST['textarea3']; echo $textareas; Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted August 7, 2008 Author Share Posted August 7, 2008 This is one way of doing it, however not very efficient. <?php $textareas = $_POST['textarea1'] . $_POST['textarea2'] . $_POST['textarea3']; echo $textareas; Good idea but like i said there wont be a sent number of textareas. There may be 4 sometime and 66 other times. So i think i need some kind of loop to find out how many textareas i have got and then use your code. Hope you understand Thankyou Paul Quote Link to comment Share on other sites More sharing options...
moselkady Posted August 8, 2008 Share Posted August 8, 2008 You can make a loop similar to this one: <?php $i = 1; while(true) { if (!isset($_POST["white_move_".$i])) break; // do whatever you'd like with $_POST["white_move_".$i] $i++; } ?> Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted August 8, 2008 Author Share Posted August 8, 2008 Just to confirm. Ill put that in my code and when theres no more white_move_$1 the loop will stop? I like that. Thankyou very much Paul Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.