Need Help - how to include session data into a form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Need Help - how to include session data into a form

Post by Celauran »

I don't understand why you'd use different variables.

Code: Select all

$mailContent .= "Product: {$row['product']}\n";
$mailContent .= "Quantity: {$row['quantity']}\n";
etc.
Tokunbo
Forum Commoner
Posts: 46
Joined: Thu Sep 29, 2011 8:53 am

Re: Need Help - how to include session data into a form

Post by Tokunbo »

@Celauran,
Hi,

actually, in my table, I have datas like this:
ColumnName1 ColumnName2 ColumnName3 ColumnName4
data1a data2a data3a data4a
data1b data2b data3b data4b
data1c data2c data3c data4c

From what I had been assisted to do earlier, I can get One Column of data and its contents written to a file through a single variable. I am asking about the other columns and their contents, how to get all the data in one variable and be able to unpack them into rows and columns in a text file.

With the previous, I have something like this:
ColumnName
data1a
data1b
data1c

so If I want to output the 2 columns, it looks like this:
ColumnName
data1a
data1b
data1c
ColumnName
data2a
data2b
data2c

Note, I want to write the cart's content to a file, so it should have a table format(the first one) like the above.

here is my code:

Code: Select all

while ($row = mysql_fetch_array($result))
{
	$xProduct = $row['Product'];
	$xQuantity = $row['Quantity'];
	$xArray[] = $xProduct;
}
	foreach($xArray as $key => $value )
	{
	echo $key. " ". $value. "<br>";
	}

regards
Toks
deragoku
Forum Newbie
Posts: 3
Joined: Thu Apr 12, 2012 2:28 am

Re: Need Help - how to include session data into a form

Post by deragoku »

I'm confused, just a little, because the product definition of the dollar, even if you do not use the code, I suggest $ mail Content is picked as undefined.
Tokunbo
Forum Commoner
Posts: 46
Joined: Thu Sep 29, 2011 8:53 am

Re: Need Help - how to include session data into a form

Post by Tokunbo »

@deragoku
deragoku wrote:I'm confused, just a little, because the product definition of the dollar, even if you do not use the code, I suggest $ mail Content is picked as undefined.
are you referring to Celaura's / my code?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Need Help - how to include session data into a form

Post by requinix »

Tokunbo wrote:@deragoku
deragoku wrote:I'm confused, just a little, because the product definition of the dollar, even if you do not use the code, I suggest $ mail Content is picked as undefined.
are you referring to Celaura's / my code?
deragoku is a spammer - look at the link in its signature. Just ignore what it says.
Post Reply