problem while access value to other page

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

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

problem while access value to other page

Post by eshban »

feyd | Yar, start posting code in

Code: Select all

and

Code: Select all

tags or not at all. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


here is a simple code, which retrieves size from database. Size is stored in string format which is "M-L-XL-XXL".
i use the explode function, and store all the sizes in combox like M, L , XL and XXL are seperatley.

i want that when i press the submit button, then it will transfer that values of combox, which i selected. kindly help me in this regard.

here is the code

Code: Select all

$query = mysql_query("Select * from newproductinfo where pid=$pageid",$db) or die ("Error");
	
	
	while ($result = mysql_fetch_array($query))	
	{
		$size=$result['size'];		
         }

echo"Size: <select name='select'>";
		$sizes = explode("-",$size);
		
		if($sizes[0]<>"")
		{
		echo"<option value='M'>$sizes[0]</option>";

		}
		if($sizes[1]<>"")
		{
		echo"<option value='L'>$sizes[1]</option>";
//		echo"<input type='hidden' value='L' name='size'>";
		}
		if($sizes[2]<>"")
		{
		echo"<option value='XL'>$sizes[2]</option>";
		}
		if($sizes[3]<>"")
		{
		echo"<option value='XXL'>$sizes[3]</option>";
		}
		echo"</select>";
plz help in this regard


feyd | Yar, start posting code in

Code: Select all

and

Code: Select all

tags or not at all. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

first off you have to make $size an array, when defining $size do $size[] = $what['ever']; otherwise $size will just contain a string value instead of array which you want it to be when you are using $size[0], $size[1] and so on

second pppplease use php tags when posting code

third i dont thing that <> works in php, im perdy sure that c++ or somthing but i have never seen that in php

lastly, what is it you want to happen in the end, be specific
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

alternatively. use if($sizes[0] != "")


arrrrr
Post Reply