TimUSA Posted December 29, 2007 Share Posted December 29, 2007 I'm not sure if this is the right approach, obviously since I cant get it to work: $postbody = 'An AYC Racing Fleet Results Report has been reported by ' . $context['user']['name'] .'<br /> [table] [tr][td]Host: ' . $_POST['host'] . '[/td][/tr] [tr][td]Date: ' . $_POST['date'] . '[/td][/tr] [tr][td]Race Factor: ' . $_POST['factor'] . '[/td][/tr] [tr][td]Number of boats: ' . $_POST['boats'] . '[/td][/tr] [tr][td]Name: ' . $_POST['name'][$x] . '[/td] [td]Points this Race: ' . $_POST['points'][$x] . '[/td] [td]Ladder Points: ' . $points . '[/td][/tr] [/table]'; $postbody2 = 'Results<br />' while ($x < $times) { '[table] [tr][td]Number of boats: ' . $_POST['boats'] . '[/td][/tr] [tr][td]Name: ' . $_POST['name'][$x] . '[/td] [td]Race Points: ' . $_POST['points'][$x] . '[/td] [td]Ladder Points: ' . $points . '[/td][/tr] [/table]'; ++$x; } EDIT: Ok I have a series of forms #1 gathers some prelim info so i wont bother with it here. #2 transfers the info from #1 and then the users input a series of race results when submitted it goes to the last page which submits the information to an SMF forum thread form #1 global $scripturl; $query = "SELECT `memberName` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;"; $result = mysql_query($query); //////ENTRY FORM////// //Hosting Information echo ' <form action="'.$scripturl.'?page=182'.$GET['page'].'" method="post"> <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" /> <hr style="width: 100%; height: 2px;" /> <h4>HOSTING INFORMATION</h4> <hr style="width: 100%; height: 2px;" /> <table> <tr> <td align="left"><p><b>HOST :</b></p>'; echo' <SELECT id="host" name="host" style="WIDTH: 160px" value ="'; echo '" />'; if(mysql_num_rows($result)) { // we have at least one user, so show all users as options in select form while($row = mysql_fetch_row($result)) { print("<option value=\"$row[0]\">$row[0]</option>"); } } else { print("<option value=\"\">No users created yet</option>"); mysql_data_seek($result, 0); } echo' </td> <td align="left"><p><b>DATE :</b></P><input type="date type" name="date" id="date" value</a><b> yyyy/mm/dd</b></td> </tr> <tr> <td><b>NUMBER OF BOATS IN RACE: </b><input type="text" name="boats" maxlength="2" size="3" /></td> </tr> <tr> <td align="left"><p><b>RACE TYPE :</b></p><SELECT id="factor" name="factor" style="WIDTH: 300px" value ="'; echo '" /> <OPTION value="3" selected>Fleet Race</OPTION> <OPTION value="3">Match Race</OPTION>'; if ($context['allow_admin']) echo' <OPTION value="2">Fleet - Club Race</OPTION> <OPTION value="1">Fleet - Championship Series</OPTION> </SELECT></td></tr>'; echo' </table> <tr> <td><INPUT type="submit" value="Submit"><INPUT type="reset" value="Reset"></td> </tr> </table><br></form>'; form #2 //////CONFIGURATION////// global $scripturl; $query = "SELECT `memberName` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;"; $result = mysql_query($query); //////ENTRY PAGE 2////// ///HOSTING INFORMATION if (isset($_POST['submitted'])) { echo' <hr style="width: 100%; height: 2px;" /> <h4>HOSTING INFORMATION</h4><hr style="width: 100%; height: 2px;" /> <form action="'.$scripturl.'?page=183'.$GET['page'].'" method="post"> <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" /> <table> <tr><td><p><b>HOST :</b></P><input type="text" READONLY name="host" value="' . $_POST['host'] . '" /></td></tr> <tr><td><p><b>DATE :</b></P><input type="text" READONLY name="date" value="' . $_POST['date'] . '" /></td></tr> <tr><td><p><b>Number of Boats :</b></P><input type="text" READONLY name="boats" value="' . $_POST['boats'] . '" /></td></tr> <tr><td><p><b>Race Factor :</b></P><input type="text" READONLY name="factor" value="' . $_POST['factor'] . '" /></td></tr> </table> <hr style="width: 100%; height: 2px;" /> <h4>ENTER RESULTS</h4> <hr style="width: 100%; height: 2px;" />'; //LOOP $times = $_POST['boats']; $x = 0; while ($x < $times) { ///RESULTS ENTRY echo' <table> <tr> <td> <SELECT id="name" name="name[ ]" style="WIDTH: 160px" value ="'; echo '" />'; if(mysql_num_rows($result)) { // we have at least one user, so show all users as options in select form while($row = mysql_fetch_row($result)) { print("<option value=\"$row[0]\">$row[0]</option>"); } } else { print("<option value=\"\">No users created yet</option>"); } echo' </td> <td><SELECT id="points" name="points[ ]" style="WIDTH: 60px" value ="'; echo '" /> <OPTION value="DNF" selected>DNF</OPTION> <OPTION value="DNS">DNS</OPTION> <OPTION value=".75">1</OPTION> <OPTION value="2">2</OPTION> <OPTION value="3">3</OPTION> <OPTION value="4">4</OPTION> <OPTION value="5">5</OPTION> <OPTION value="6">6</OPTION> <OPTION value="7">7</OPTION> <OPTION value="8">8</OPTION> <OPTION value="9">9</OPTION> <OPTION value="10">10</OPTION> <OPTION value="11">11</OPTION> <OPTION value="12">12</OPTION> <OPTION value="13">13</OPTION> <OPTION value="14">14</OPTION> <OPTION value="15">15</OPTION> <OPTION value="16">16</OPTION> <OPTION value="17">17</OPTION> <OPTION value="18">18</OPTION> <OPTION value="19">19</OPTION> <OPTION value="20">20</OPTION> <OPTION value="21">21</OPTION> <OPTION value="22">22</OPTION> <OPTION value="23">23</OPTION> <OPTION value="24">24</OPTION> <OPTION value="25">25</OPTION> <OPTION value="26">26</OPTION> <OPTION value="27">27</OPTION> <OPTION value="28">28</OPTION> <OPTION value="29">29</OPTION> <OPTION value="30">30</OPTION> </SELECT></td> </tr>'; mysql_data_seek($result, 0); ++$x; } echo' <tr> <td><INPUT type="submit" value="Submit"><INPUT type="reset" value="Reset"></td> </tr> </table></form>'; } and finally page 3: global $user_info, $context, $scripturl, $user_info, $sourcedir; require_once($sourcedir . '/Subs.php'); require_once($sourcedir .'/Subs-Post.php'); // CONFIGURATION SECTION $times = $_POST['boats']; $x = 0; if ($_POST['points'][$x] == "DNF") $points = ($_POST['boats'] +1) * $_POST['factor']; else if ($_POST['points'][$x] == "DNS") $points = ($_POST['boats'] +1) * $_POST['factor']; else $points = $_POST['points'][$x] * $_POST['factor']; //post the application on forum? $enable_post=true; //board id to which the application should be posted $board_id=37; //the id of the this article $this_article_id = '183'; //article to be redirected when form is submitted $thank_you_article_id = '71'; $show_form= 'true'; if (isset($_POST['submitted'])) { // Handle the form // Check required fields $enroll_errors = array(); //Initialize error array // Check for number of boats if (empty($_POST['boats']) ){ $enroll_errors[] = 'You forgot to enter the number of boats, return to page 1.'; } if (empty($enroll_errors)) { //Everything seems to be OK $show_form='false'; $postbody = 'An AYC Racing Fleet Results Report has been reported by ' . $context['user']['name'] .'<br /> [table] [tr][td][b]Host:[/b] ' . $_POST['host'] . '[/td][/tr] [tr][td][b]Date:[/b] ' . $_POST['date'] . '[/td][/tr] [tr][td][b]Race Factor:[/b] ' . $_POST['factor'] . '[/td][/tr] [tr][td][b]Number of boats:[/b] ' . $_POST['boats'] . '[/td][/tr] [tr][td] [left][b]Name:[/b] ' . $_POST['name'][$x] . '[/left] [/td] [td] [center][b] Points this Race:[/b] ' . $_POST['points'][$x] . '[/center] [/td] [td] [right][b] Ladder Points:[/b] ' . $points . '[/right] [/td][/tr] [/table]'; //create new forum post with application $msgOptions = array( 'id' => 0 , 'subject' => 'An AYC Racing Fleet Results Report has been reported by ' . $context['user']['name'], 'body' => $postbody , 'icon' => 'xx', 'smileys_enabled' => true, 'attachments' => array(), ); $topicOptions = array( 'id' => 0 , 'board' => $board_id, 'poll' => null, 'lock_mode' => null, 'sticky_mode' => null, 'mark_as_read' => true, ); $posterOptions = array( 'id' => $context['user']['id'], 'name' => $context['user']['name'], 'email' => $user_info['email'], 'update_post_count' => true, ); if ($enable_post) createPost($msgOptions, $topicOptions, $posterOptions); // Redirect to thank you page header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id); } else { // Redirect to error page //header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id ); echo '<h2 class="error">Error!</h2>'; echo '<p class="error">The following error(s) occured:<br />'; foreach ($enroll_errors as $msg) { echo " - $msg<br />"; } echo "<p>Please, correct all errors and try again.</p>" ; } } The problem I am having is that when page three is submitting to the thread which is set in $postbody it is only transferring the first line. So if three results are inputted, only one posts correctly. So in my first code example, I was trying to determine if a loop can be put inside a variable. I thought maybe this would solve the problem. When I try it, it returns an unexpected T while error. So I am stuck with what to do here. Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/ Share on other sites More sharing options...
trq Posted December 29, 2007 Share Posted December 29, 2007 Can you format your post so it is readable? Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425001 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 done...hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425010 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 anybody out there that can help? Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425058 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 just realized i put the wrong code in block #3 Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425062 Share on other sites More sharing options...
MikeDXUNL Posted December 29, 2007 Share Posted December 29, 2007 I noticed in the first set of code, you didn't define $times.. also, your ++$x is backwards... try something like $i = 0; $times = 15; while($i <= $times) { echo "The number is " . $i . "<br />"; $i++; } That will echo: The number is 0 The number is 1 The number is 2 The number is 3 Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425064 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 still getting this: Parse error: syntax error, unexpected T_WHILE in /home/vskayc/public_html/Sources/Load.php(1773) : eval()'d code(209) : eval()'d code on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425066 Share on other sites More sharing options...
MikeDXUNL Posted December 29, 2007 Share Posted December 29, 2007 make sure you have semi-colon's ending your lines before the while statement and the variables. one of my favorite programs is PHP Designer. It helps me quickly catch unfinished lines in the syntax Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425068 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 ok $x and $times are defined in another part of the code. i edited the code to read: $postbody2 = 'Results<br />'; while ($x < $times) { '[table] [tr][td]Number of boats: ' . $_POST['boats'] . '[/td][/tr] [tr][td]Name: ' . $_POST['name'][$x] . '[/td] [td]Race Points: ' . $_POST['points'][$x] . '[/td] [td]Ladder Points: ' . $points . '[/td][/tr] [/table]'; ++$x; } but it still is not posting to the thread with all of the results entered? Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425071 Share on other sites More sharing options...
anatak Posted December 29, 2007 Share Posted December 29, 2007 are you sure you get all the $_POST vars ? I always use a print_r($_POST) while programming to make sure that the information is actually sent. also try this $postbody2 = 'Results<br />'; while ($x < $times) { $x++; '[table] [tr][td]'.$x.'[/td][/tr] [tr][td]Number of boats: ' . $_POST['boats'] . '[/td][/tr] [tr][td]Name: ' . $_POST['name'][$x] . '[/td] [td]Race Points: ' . $_POST['points'][$x] . '[/td] [td]Ladder Points: ' . $points . '[/td][/tr] [/table]'; } Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425074 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 Yes. The original problem is that in code block #3 where i attempt to post to a forum thread was only returning one line of values vs. the multiple entries. so i tried looping it like i did on previous pages. I think because my $postbody2 is not actually php its not looping it right. maybe loop it in another variable like $stuff and then make my $postbody2 = $stuff? Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425076 Share on other sites More sharing options...
anatak Posted December 29, 2007 Share Posted December 29, 2007 in your second code block I see this <SELECT id="name" name="name[ ]" style="WIDTH: 160px" value ="'; echo '" />'; I think you have to make it <SELECT id="name" name="name[<?php echo $x; ?> ]" style="WIDTH: 160px" value ="'; echo '" />'; otherwise you will only have one result posted also in your second block you have while ($x < $times) { ///RESULTS ENTRY echo' <table> that means that you start a new table for every result. I would put the <table> tag outside the while loop OR put your </table> tag inside the while loop Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425082 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 did all of the above and still no result this is what page 2 looks like now: //////CONFIGURATION////// global $scripturl; $query = "SELECT `memberName` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;"; $result = mysql_query($query); //////ENTRY PAGE 2////// ///HOSTING INFORMATION if (isset($_POST['submitted'])) { echo' <hr style="width: 100%; height: 2px;" /> <h4>HOSTING INFORMATION</h4><hr style="width: 100%; height: 2px;" /> <form action="'.$scripturl.'?page=183'.$GET['page'].'" method="post"> <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" /> <table> <tr><td><p><b>HOST :</b></P><input type="text" READONLY name="host" value="' . $_POST['host'] . '" /></td></tr> <tr><td><p><b>DATE :</b></P><input type="text" READONLY name="date" value="' . $_POST['date'] . '" /></td></tr> <tr><td><p><b>Number of Boats :</b></P><input type="text" READONLY name="boats" value="' . $_POST['boats'] . '" /></td></tr> <tr><td><p><b>Race Factor :</b></P><input type="text" READONLY name="factor" value="' . $_POST['factor'] . '" /></td></tr> </table> <hr style="width: 100%; height: 2px;" /> <h4>ENTER RESULTS</h4> <hr style="width: 100%; height: 2px;" />'; //LOOP $times = $_POST['boats']; $x = 0; while ($x < $times) { ///RESULTS ENTRY echo' <table> <tr> <td> <SELECT id="name" name="name[<?php echo $x; ?> ]" style="WIDTH: 160px" value ="'; echo '" />'; if(mysql_num_rows($result)) { // we have at least one user, so show all users as options in select form while($row = mysql_fetch_row($result)) { print("<option value=\"$row[0]\">$row[0]</option>"); } } else { print("<option value=\"\">No users created yet</option>"); } echo' </td> <td><SELECT id="points" name="points[<?php echo $x; ?> ]" style="WIDTH: 60px" value ="'; echo '" /> <OPTION value="DNF" selected>DNF</OPTION> <OPTION value="DNS">DNS</OPTION> <OPTION value=".75">1</OPTION> <OPTION value="2">2</OPTION> <OPTION value="3">3</OPTION> <OPTION value="4">4</OPTION> <OPTION value="5">5</OPTION> <OPTION value="6">6</OPTION> <OPTION value="7">7</OPTION> <OPTION value="8">8</OPTION> <OPTION value="9">9</OPTION> <OPTION value="10">10</OPTION> <OPTION value="11">11</OPTION> <OPTION value="12">12</OPTION> <OPTION value="13">13</OPTION> <OPTION value="14">14</OPTION> <OPTION value="15">15</OPTION> <OPTION value="16">16</OPTION> <OPTION value="17">17</OPTION> <OPTION value="18">18</OPTION> <OPTION value="19">19</OPTION> <OPTION value="20">20</OPTION> <OPTION value="21">21</OPTION> <OPTION value="22">22</OPTION> <OPTION value="23">23</OPTION> <OPTION value="24">24</OPTION> <OPTION value="25">25</OPTION> <OPTION value="26">26</OPTION> <OPTION value="27">27</OPTION> <OPTION value="28">28</OPTION> <OPTION value="29">29</OPTION> <OPTION value="30">30</OPTION> </SELECT></td> </tr></table>'; mysql_data_seek($result, 0); ++$x; } echo' <table> <tr> <td><INPUT type="submit" value="Submit"><INPUT type="reset" value="Reset"></td> </tr> </table></form>'; } Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425085 Share on other sites More sharing options...
anatak Posted December 29, 2007 Share Posted December 29, 2007 ooops <SELECT id="name" name="name[<?php echo $x; ?> ]" style="WIDTH: 160px" value ="'; will not work since you are already in an echo <SELECT id="name" name="name['.$x.']" style="WIDTH: 160px" ; will be better this will not work neither I think <SELECT id="points" name="points[<?php echo $x; ?> ]" style="WIDTH: 60px" value ="'; echo '" /> is kinda weird <select> does not use a value. and you do not need /> at the end of <select> as you have a closing tag </select> <SELECT id="points" name="points['.$x.']" style="WIDTH: 60px"> also as a remark HTML 4.0 code should not be written in CAPS also in while($row = mysql_fetch_row($result)) { print("<option value=\"$row[0]\">$row[0]</option>"); } } else { print("<option value=\"\">No users created yet</option>"); } echo' </td> you are sure that $row[0] is the userinfo I prefer to use the names of the arrays do a print_r[$row] and you will see that in the array you have the numeral value $row[0] and that the same info is hold with a textual value $row[userId] (or something like that) and you should also replace the ++$x with $x++ I am not sure if ++$x works or not but someone else suggested that. not following the suggestions of the people who try to help you will result in them stop helping you I am afraid. Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425095 Share on other sites More sharing options...
MikeDXUNL Posted December 29, 2007 Share Posted December 29, 2007 or if you are trying to do an array like: <form action="somewhere.php" method="post"> <input type="text" name="name[]" /> <input type="text" name="name[]" /> <input type="text" name="name[]" /> </form> in the PHP $stuff = $_POST['name']; foreach($stuff as $var) { echo $var."<br />"; } i am still not sure what you are trying to accomplish, message me your AIM or MSN and we can talk Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425097 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 OK... here is my page 2 revised: //////CONFIGURATION////// global $scripturl; $query = "SELECT `memberName` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;"; $result = mysql_query($query); //////ENTRY PAGE 2////// ///HOSTING INFORMATION if (isset($_POST['submitted'])) { echo' <hr style="width: 100%; height: 2px;" /> <h4>HOSTING INFORMATION</h4><hr style="width: 100%; height: 2px;" /> <form action="'.$scripturl.'?page=183'.$GET['page'].'" method="post"> <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" /> <table> <tr><td><p><b>HOST :</b></P><input type="text" READONLY name="host" value="' . $_POST['host'] . '" /></td></tr> <tr><td><p><b>DATE :</b></P><input type="text" READONLY name="date" value="' . $_POST['date'] . '" /></td></tr> <tr><td><p><b>Number of Boats :</b></P><input type="text" READONLY name="boats" value="' . $_POST['boats'] . '" /></td></tr> <tr><td><p><b>Race Factor :</b></P><input type="text" READONLY name="factor" value="' . $_POST['factor'] . '" /></td></tr> </table> <hr style="width: 100%; height: 2px;" /> <h4>ENTER RESULTS</h4> <hr style="width: 100%; height: 2px;" />'; //LOOP $times = $_POST['boats']; $x = 0; while ($x < $times) { ///RESULTS ENTRY echo' <table> <tr> <td> <SELECT id="name" name="name['.$x.']" style="WIDTH: 160px" value ="'; echo '" />'; if(mysql_num_rows($result)) { // we have at least one user, so show all users as options in select form while($row = mysql_fetch_row($result)) { print("<option value=\"$row[0]\">$row[0]</option>"); } } else { print("<option value=\"\">No users created yet</option>"); } echo' </td> <td><SELECT id="points" name="points['.$x.']" style="WIDTH: 60px" value ="'; echo '" /> <OPTION value="DNF" selected>DNF</OPTION> <OPTION value="DNS">DNS</OPTION> <OPTION value=".75">1</OPTION> <OPTION value="2">2</OPTION> <OPTION value="3">3</OPTION> <OPTION value="4">4</OPTION> <OPTION value="5">5</OPTION> <OPTION value="6">6</OPTION> <OPTION value="7">7</OPTION> <OPTION value="8">8</OPTION> <OPTION value="9">9</OPTION> <OPTION value="10">10</OPTION> <OPTION value="11">11</OPTION> <OPTION value="12">12</OPTION> <OPTION value="13">13</OPTION> <OPTION value="14">14</OPTION> <OPTION value="15">15</OPTION> <OPTION value="16">16</OPTION> <OPTION value="17">17</OPTION> <OPTION value="18">18</OPTION> <OPTION value="19">19</OPTION> <OPTION value="20">20</OPTION> <OPTION value="21">21</OPTION> <OPTION value="22">22</OPTION> <OPTION value="23">23</OPTION> <OPTION value="24">24</OPTION> <OPTION value="25">25</OPTION> <OPTION value="26">26</OPTION> <OPTION value="27">27</OPTION> <OPTION value="28">28</OPTION> <OPTION value="29">29</OPTION> <OPTION value="30">30</OPTION> </SELECT></td> </tr></table>'; mysql_data_seek($result, 0); $x++; } echo' <table> <tr> <td><INPUT type="submit" value="Submit"><INPUT type="reset" value="Reset"></td> </tr> </table></form>'; } <SELECT id="name" name="name['.$x.']" style="WIDTH: 160px" ; Changed! and you should also replace the ++$x with $x++ Changed! you are sure that $row[0] is the userinfo Yes, It took my amateur arse hours to get that part working!! Now when I actually go through these forms and the end result being a post to a form thread, i get this: An AYC Racing Fleet Results Report has been reported by TimUSA Host: alvaritop Date: 2007/12/29 Race Factor: 4 Number of boats: 3 Name: alvaritop Points this Race: DNF Ladder Points: 16 I should be getting three rows of results. this is created by page 3 global $user_info, $context, $scripturl, $user_info, $sourcedir; require_once($sourcedir . '/Subs.php'); require_once($sourcedir .'/Subs-Post.php'); // CONFIGURATION SECTION $times = $_POST['boats']; $x = 0; if ($_POST['points'][$x] == "DNF") $points = ($_POST['boats'] +1) * $_POST['factor']; else if ($_POST['points'][$x] == "DNS") $points = ($_POST['boats'] +1) * $_POST['factor']; else $points = $_POST['points'][$x] * $_POST['factor']; //post the application on forum? $enable_post=true; //board id to which the application should be posted $board_id=37; //the id of the this article $this_article_id = '183'; //article to be redirected when form is submitted $thank_you_article_id = '71'; $show_form= 'true'; if (isset($_POST['submitted'])) { // Handle the form // Check required fields $enroll_errors = array(); //Initialize error array // Check for number of boats if (empty($_POST['boats']) ){ $enroll_errors[] = 'You forgot to enter the number of boats, return to page 1.'; } if (empty($enroll_errors)) { //Everything seems to be OK $show_form='false'; $postbody = 'An AYC Racing Fleet Results Report has been reported by ' . $context['user']['name'] .'<br /> [table] [tr][td][b]Host:[/b] ' . $_POST['host'] . '[/td][/tr] [tr][td][b]Date:[/b] ' . $_POST['date'] . '[/td][/tr] [tr][td][b]Race Factor:[/b] ' . $_POST['factor'] . '[/td][/tr] [tr][td][b]Number of boats:[/b] ' . $_POST['boats'] . '[/td][/tr] [tr][td] [left][b]Name:[/b] ' . $_POST['name'][$x] . '[/left] [/td] [td] [center][b] Points this Race:[/b] ' . $_POST['points'][$x] . '[/center] [/td] [td] [right][b] Ladder Points:[/b] ' . $points . '[/right] [/td][/tr] [/table]'; //create new forum post with application $msgOptions = array( 'id' => 0 , 'subject' => 'An AYC Racing Fleet Results Report has been reported by ' . $context['user']['name'], 'body' => $postbody , 'icon' => 'xx', 'smileys_enabled' => true, 'attachments' => array(), ); $topicOptions = array( 'id' => 0 , 'board' => $board_id, 'poll' => null, 'lock_mode' => null, 'sticky_mode' => null, 'mark_as_read' => true, ); $posterOptions = array( 'id' => $context['user']['id'], 'name' => $context['user']['name'], 'email' => $user_info['email'], 'update_post_count' => true, ); if ($enable_post) createPost($msgOptions, $topicOptions, $posterOptions); // Redirect to thank you page header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id); } else { // Redirect to error page //header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id ); echo '<h2 class="error">Error!</h2>'; echo '<p class="error">The following error(s) occured:<br />'; foreach ($enroll_errors as $msg) { echo " - $msg<br />"; } echo "<p>Please, correct all errors and try again.</p>" ; } } Hopefully I have been descriptive enough to show whats happening: Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425102 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425338 Share on other sites More sharing options...
redarrow Posted December 29, 2007 Share Posted December 29, 2007 if (isset($_POST['submitted'])) { to name="submitted" <INPUT name="submitted" type="submit" value="Submit"><INPU T type="reset" value="Reset"></td> Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425346 Share on other sites More sharing options...
TimUSA Posted December 29, 2007 Author Share Posted December 29, 2007 thanks arrow, as i am new i dont catch all those little things. this unfortunately did not solve the problem Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425360 Share on other sites More sharing options...
TimUSA Posted December 30, 2007 Author Share Posted December 30, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/83530-looping-_post-info-in-a-variable/#findComment-425685 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.