Re: Newbie: Fundamental question. Long.

From: Date: Mon, 19 Feb 2001 06:45:55 +0000
Subject: Re: Newbie: Fundamental question. Long.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40523@lists.php.net to get a copy of this message
You can't easily transfer a PHP variable from one FRAME to another, *unless* you go through the parent (FRAMESET) page. So, if you are using FRAMEs for their scrolling properties and their "look" rather than "not refreshing" the left frame, you just have to make all your TARGET="_top" and then in the main page, pass everything down to the FRAME URLs. <FRAMESET ...> <FRAME SRC=navbar.php?id=<?php echo $id;?> ...> <FRAME SRC=search.php?id=<?php echo $id;?> ...> <FRAME SRC=results.php?id=<?php echo $id;?> ...> </FRAMESET ...> -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: "james" <james@inetia.pl> Newsgroups: php.general Sent: Friday, February 16, 2001 6:11 PM Subject: [PHP] Newbie: Fundamental question. Long. > I have a feeling that after receiving answer to this question I will be able > to do everything I want...:) > > > SHOP: > > Page has three frames: left, right_top and right_down. > > Left frame: > <? > echo " <form method=post action=right_top.php target=right_top>"; > echo " <input type=hidden name=action value=search_for_phrase>"; > echo " <p> "; > echo " <input type=text name=phrase>"; > echo " <input type=submit name=button value=Search>"; > echo " </p>"; > echo " </form>"; > > ?> > > Right_top frame: > (right_top.php) > > if ($action=="search_for_phrase"){ > searching_for_phrase($phrase); > exit(); > } > > } > > function searching_for_phrase($phrase) > { > ibase_connect('www.gdb','james','james'); > $query=ibase_query("select id, name, price from shop where name like > '%$phrase%';"); > show_records($query); > } > > function showrecords($query) > { > echo "<TABLE bgcolor=#FBFDB9 BORDER=1 borderColor=#ffffff CELLPADDING=0 > CELLSPACING=2 HEIGTH=80><tr>"; > echo "<TD ALIGN=CENTER>ID</TD><TD ALIGN=CENTER>Name</TD><TD > ALIGN=CENTER>Price</TD></TR>"; > while(&record=ibase_fetch_row($tresc_query)) { > echo "<tr><td align=center> $record[0] </td>"; > id_of_product > echo "<td align=center width=150> $record[1] </td>"; > name_of_product > echo "<td align=center width=150> $record[2] </td>"; > price_of_product > > > > // echo " <input type=hidden name=id value=$record[1]>"; > // echo "<td align=center><input type=submit name=action > value='Add'></td></tr>"; ????????????????????????? > > // echo "<td align=center><A HREF=\"$PHP_SELF > ?id_of_product=$record[0]&name_of_product=$wiersz[1]&price_of_product=$wiers > z[2]&action='add'\">Add</A></td>";??????????????// > > ***************How can I transfer variable $id_of_product to right_down > frame?????????????????************* > > > Right_down frame: > > <? > if ($action=="add") { > adding($id_of_product); > exit(); > } > > function adding($id_of_product) > { > > if ($id_of_product!=""){ > if (session_is_registered("ses_basket_items")){ > $basket_position_counter=0; > $double=0; > if ($ses_basket_items>0){ > foreach ($ses_basket_name as $basket_item){ > if ($basket_item==$name_of_product){ > $double=1; > $basket_position=$basket_position_counter; > } > $basket_position_counter++; > } > } > > if ($double==1){ > $oldamount=$ses_basket_amount[$basket_position]; > $ses_basket_amount[$basket_position]++; > $price_of_product*$ses_basket_amount[$basket_position]; > > $ses_basket_price[$basket_position]=$price_of_product*$ses_basket_amount[$ba > sket_position]; > } > else > > > $ses_basket_name[]=$name_of_product; > $ses_basket_amount[]=1; > $ses_basket_price[]=$price_of_product; > $ses_basket_items++; > } > } > else > > > $ses_basket_items=1; > $ses_basket_name[0]=$name_of_product; > $ses_basket_amount[0]=1; > $ses_basket_price[0]=$price_of_product; > session_register("ses_basket_items"); > session_register("ses_basket_name"); > session_register("ses_basket_amount"); > session_register("ses_basket_price"); > } > > } > > if ($ses_basket_items>0){ > for > ($basket_counter=0;$basket_counter<$ses_basket_items;$basket_counter++){ > $price=sprintf("%01.2f",$ses_basket_price[$basket_counter]); > $amount=$ses_basket_amount[$basket_counter]; > $name=$ses_basket_name[$basket_counter]; > if ($amount>0){ > echo "$amount $name $price"; > echo "<BR>"; > } > } > else > { > $ses_basket_items=0; > unset($ses_basket_name); > unset($ses_basket_amount); > unset($ses_basket_price); > } > > ?> > > The purpose of this frame is to add items to a basket: > - checking if there is product of a certain name in basket- if so increasing > amount by one if not adding the name to basket > - printing on screen the state of the basket. > > Please answer my above question...:) > I mean: > ***************How can I transfer variable $id_of_product to right_down > frame?????????????????************* > Thanks in advance > > Adamski > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#40523) next »