pirs0103 Posted February 23, 2009 Share Posted February 23, 2009 <input type='hidden' name='record' value='<?for each($_POST['seats'] As $seat){ $rowid=substr($seat,0,1); $columnid=substr($seat,0,1); echo $rowid.$columnid.","; }?>' /> <? $x=$_POST['record']; echo $x; ?> I want to get the value in the <input type='text'> and put it into variable $x, the problem is I dint get any value... but the value are already print in the textbox... Help me please... Quote Link to comment https://forums.phpfreaks.com/topic/146454-help-me-to-do-the-_post/ Share on other sites More sharing options...
linkednet Posted February 23, 2009 Share Posted February 23, 2009 When you are trying to grab post information you have to first post it. That is done by using a form. I'll give you an example and some links to very useful php tutorials. http://www.w3schools.com/php/php_post.asp http://www.tizag.com/phpT/postget.php You can either make a form that goes to a php script that grabs the information, or, you can just run it within the same page. But, if you don't tell it to store the data somewhere, you can't call it again once you leave that page.(Correct me if I am wrong.) Examples: Form: <form action="process.php" method="post"> <input type='hidden' name='record' value='<?for each($_POST['seats'] As $seat){ $rowid=substr($seat,0,1); $columnid=substr($seat,0,1); echo $rowid.$columnid.","; }?>' /> <input name="submit" type="submit" value="Submit"> </form> process.php: <? $x=$_POST['record']; echo $x; ?> Or, you can do it like I do it on some of my scripts. Form: <formmethod="post"> <input type='hidden' name='record' value='<?for each($_POST['seats'] As $seat){ $rowid=substr($seat,0,1); $columnid=substr($seat,0,1); echo $rowid.$columnid.","; }?>' /> <input name="submit" type="submit" value="Submit"> </form> <?php if($_POST['submit']) { $x = $_POST['record']; echo $x; } ?> It takes what is in the Quote Link to comment https://forums.phpfreaks.com/topic/146454-help-me-to-do-the-_post/#findComment-768880 Share on other sites More sharing options...
pirs0103 Posted February 23, 2009 Author Share Posted February 23, 2009 How to get the value inside the WHILE STATEMENT while ($myrow1 = mysql_fetch_array($result)) { $reservedby= $myrow1['reservedby']; $row= $myrow1['rowId']; $column= $myrow1['columnId']; echo "$row"."$column".","; } For example the value that the fetch array have get are A,B,C,D -- then how can i Store them in one variable which is outside the while statement? I'll try to do this one but only the last value that the fetch array is being get... while ($myrow1 = mysql_fetch_array($result)) { $reservedby= $myrow1['reservedby']; $row= $myrow1['rowId']; $column= $myrow1['columnId']; $recs= "$row"."$column".","; } echo $recs; only the last value is print, how can i print all the values outside the while? is there any code for that... please help me.... Quote Link to comment https://forums.phpfreaks.com/topic/146454-help-me-to-do-the-_post/#findComment-768903 Share on other sites More sharing options...
sasa Posted February 23, 2009 Share Posted February 23, 2009 $recs .= "$row"."$column".","; Quote Link to comment https://forums.phpfreaks.com/topic/146454-help-me-to-do-the-_post/#findComment-768910 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.