Jump to content

Recommended Posts

<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...

 

                                                       

Link to comment
https://forums.phpfreaks.com/topic/146454-help-me-to-do-the-_post/
Share on other sites

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

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....

 
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.