473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Fieldforwarder PHP script doesn't forward fields the second timearound

Hello all,

I'm new to this newsgroup and have tried to search through the archives
first, before posting this question. I don't think it has been addressed
before. Also, this question is about a script I found on zend.com, and I
have also emailed the author of the script, unfortunately without any
replies sofar.

Here goes:

I am working on a website for pizza delivery. Through this website people
need to be able to order a pizza or pasta online.

The ordering proces will be a form with multiple pages. The visitor will be
guided through the menu in 5 steps. Step 1 being the pizzas, step 2 the
pastas, and so on.
On each page there is always the possibility to add an "side-order" to their
order. So, on the right is always the same list of side-orders.

I am using a script called fieldforwarder.php (see this page for the script:
http://www.zend.com/zend/spotlight/c...7.php#Heading9)

It works perfectly, however one challenge still remains and it has to do
with the side-order. I think it has something to do with the
fieldforwarder.php file.

The side-orders can be choosen during any step. So, if one chooses a side
order in step 1, it needs to remain chosen in the following steps. I have
this working, by using if statements. One pulldown menu in the side-order
menu looks like this:

<select name="italianchefsalad_junior" class="orderpulldown"
id="italianchefsalad_junior">
<option value="0"<?php if ($italianchefsalad_junior==0) echo "selected";
?>>0</option>
<option value="1"<?php if ($italianchefsalad_junior==1) echo "selected";
?>>1</option>
<option value="2"<?php if ($italianchefsalad_junior==2) echo "selected";
?>>2</option>
</select>

Although starting from step 2 the code looks this actually.
Well, it does work in a way that it shows me when i clicked something in the
side orders on the first page. However, when i try to choose something in
step 2 (or 3 or 4 or 5) it won't "remember" it.
I guess that the fieldforwarder.php file doesn't check for changes in
fields, it already has indexed? I'm not quite sure, because the code of the
file is a little bit too advanced for me.

Hopefully someone on here can help me out. I really hope so.

Sincerely,
Marc de Winter
Jul 17 '05 #1
2 1959

"Marc de Winter" <ma**@cura.net> wrote in message
news:BD99463D.7215%ma**@cura.net...
Hello all,

I'm new to this newsgroup and have tried to search through the archives
first, before posting this question. I don't think it has been addressed
before. Also, this question is about a script I found on zend.com, and I
have also emailed the author of the script, unfortunately without any
replies sofar.

Here goes:

I am working on a website for pizza delivery. Through this website people
need to be able to order a pizza or pasta online.

The ordering proces will be a form with multiple pages. The visitor will be guided through the menu in 5 steps. Step 1 being the pizzas, step 2 the
pastas, and so on.
On each page there is always the possibility to add an "side-order" to their order. So, on the right is always the same list of side-orders.

I am using a script called fieldforwarder.php (see this page for the script: http://www.zend.com/zend/spotlight/c...7.php#Heading9)

It works perfectly, however one challenge still remains and it has to do
with the side-order. I think it has something to do with the
fieldforwarder.php file.

The side-orders can be choosen during any step. So, if one chooses a side
order in step 1, it needs to remain chosen in the following steps. I have
this working, by using if statements. One pulldown menu in the side-order
menu looks like this:

<select name="italianchefsalad_junior" class="orderpulldown"
id="italianchefsalad_junior">
<option value="0"<?php if ($italianchefsalad_junior==0) echo "selected";
?>>0</option>
<option value="1"<?php if ($italianchefsalad_junior==1) echo "selected";
?>>1</option>
<option value="2"<?php if ($italianchefsalad_junior==2) echo "selected";
?>>2</option>
</select>

Although starting from step 2 the code looks this actually.
Well, it does work in a way that it shows me when i clicked something in the side orders on the first page. However, when i try to choose something in
step 2 (or 3 or 4 or 5) it won't "remember" it.
I guess that the fieldforwarder.php file doesn't check for changes in
fields, it already has indexed? I'm not quite sure, because the code of the file is a little bit too advanced for me.

Hopefully someone on here can help me out. I really hope so.

Sincerely,
Marc de Winter


It's been my experience that if you do not use a space between your option
and
<?php you will not get the desired results because it would be returned as
"0"selected
instead of "0" selected. So that's your first step.

<option value="0" <?php if ($italianchefsalad_junior==0) echo "selected";

The second step is on each page either use sessions $_SESSION["item"] to
track
the items, or use $_POST["item"] $_GET["item"] or $_REQUEST["item"] to track
each item in the order. The REQUEST option does not care of it's a POST or
GET.

Jim Hutchinson
Website Managers, LLC
http://www.websitemanagers.net

Jul 17 '05 #2
Marc de Winter wrote:
The ordering proces will be a form with multiple pages. The visitor will be
guided through the menu in 5 steps. Step 1 being the pizzas, step 2 the
pastas, and so on.
On each page there is always the possibility to add an "side-order" to their
order. So, on the right is always the same list of side-orders.

I am using a script called fieldforwarder.php (see this page for the script:
http://www.zend.com/zend/spotlight/c...7.php#Heading9)


I don't have experience of the Zend script you're referring to, but this
sounds to me like a classic situation for an array session variable.

What you're describing is a shopping cart, really. I would suggest
registering a session variable called somthing like $order, and adding
things to it. It'll be an array (arbitrarily deep), so the order
information could be stored in that. For example the array might contain
(untested):

$_SESSION['order'] = array(
pizza => array (type => 'quattro formaggi', quantity => 1),
pasta => array (item => 'carbonara', quantity => 2),
italianchefsalad_junior => array (quantity => 1)
)

etc, etc.

That way, you could always refer to the session array $order to find out
what was on the buyers list (untested):

foreach ($_SESSION['order'] as $dish => $details) {
echo $dish.":<br>";
foreach ($details as $detail => $information) {
echo $detail.": ".$information."<br>";
}
echo "<br>";
}

this will give you something like:

pizza:
type: quattro formaggi
quantity: 1

pasta:
type: carbonara
quantity: 2

italianchefsalad_junior:
quantity: 1

Or you could find the quantity of italianchefsalad_junior at
$_SESSION['order']['italianchefsalad_junior']['quantity'].

Clearly the data structure needs to be carefully thought through, and my
suggested one is probably totally inappropriate for your application,
but you might get the idea.

For more info on PHP sessions and session variables, the PHP website is
essential reading (UK mirrors given):

http://uk2.php.net/manual/en/function.session-start.php
http://uk2.php.net/manual/en/functio...n-register.php

Ed


Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Fox | last post by:
I merged and modified these script which work perfectly fine as long as I use server.execute to access the VBS part (which is itself in another ASP file). When these I use a session variable to...
6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
7
by: Dr. Know | last post by:
I am working on an ASP page that writes to several databases, ranging from MDBs to x-base. One of the tasks involves using an existing highest value from the DB and incrementing it before...
6
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to...
1
by: Dan | last post by:
This is one that has me stumped and I need an expert's input. Any ideas why the values from the second script-generated drop down list isn't recognized by the script to add time values to the...
5
by: Todd Huish | last post by:
I have noticed something disturbing when retrieving datasets over a relatively slow line (multiple T1). I am looking at about 25 seconds to retrieve 500 rows via a php-odbc link. This same select...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.