473,747 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fairly simple logic problem using PHP?

Hi All!

I wonder if anyone could help me with the underlying logic of a problem I
have. At the moment my working pages run like so

---------------------------------------------------------
PAGE1: A form which gathers variables and POSTS them on to the next page.

PAGE2: This page does a few simple calculations based on the variables
gathered on PAGE1 and echoes the results to screen. It also contains a two
buttons - one lets you quit and one that allows the results to be URLENCODED
to PAGE 3

PAGE3: Takes the URLENCODED results, amalgamates them into one long string
and MAILS them to me.

END
---------------------------------------------------------
Now what I would *like* to do is add a small form on PAGE2 that would allow
people to add their contact details if the echoed results were to their
liking, before passing the whole lot on to PAGE3 as usual.

However, I get confused as to how I might be able to both submit this mini
form and at the same time be able to forward on my previously gathered
results from the form on PAGE1.

Does this makes sense? If anyone could help me out here with *anything* at
all that might help, I would be so grateful...

Thanks if you can,

Steve M.

Jul 17 '05 #1
6 2065
Steve wrote:
I wonder if anyone could help me with the underlying logic of a problem I
have. At the moment my working pages run like so

---------------------------------------------------------
PAGE1: A form which gathers variables and POSTS them on to the next page.

PAGE2: This page does a few simple calculations based on the variables
gathered on PAGE1 and echoes the results to screen. It also contains a two
buttons - one lets you quit and one that allows the results to be URLENCODED
to PAGE 3

PAGE3: Takes the URLENCODED results, amalgamates them into one long string
and MAILS them to me.

END
---------------------------------------------------------
Now what I would *like* to do is add a small form on PAGE2 that would allow
people to add their contact details if the echoed results were to their
liking, before passing the whole lot on to PAGE3 as usual.

However, I get confused as to how I might be able to both submit this mini
form and at the same time be able to forward on my previously gathered
results from the form on PAGE1.

Does this makes sense? If anyone could help me out here with *anything* at
all that might help, I would be so grateful...


You can pass parameters in the URL for a POSTed form:

## page2
<form method="post" action="page3.p hp?data=$urlenc oded_data">
<input type="text" name="address">
<input type="submit">
</form>

## page3
mail('y******** ***@example.com ', 'form data with contact details',
"Someone entered this data:\n\n" .
"{$_GET['data']}\n\n" .
"The user details are:\n" .
" address: {$_POST['address']}");
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2

"Steve" <lu***********@ hotmail.com> / :
news:40******** **************@ news.astraweb.c om...
Hi All!
[skip]
However, I get confused as to how I might be able to both submit this mini
form and at the same time be able to forward on my previously gathered
results from the form on PAGE1.

Does this makes sense? If anyone could help me out here with *anything* at
all that might help, I would be so grateful...

Thanks if you can,

Steve M.

You can use <input type="hidden" value="your_val ue_from_previou s_form"> in
your mini form on page2. Thus, you can POST results from form on page1 to
page3 via form on page2.
Jul 17 '05 #3

"Pedro Graca" <he****@hotpop. com>
[skip]
You can pass parameters in the URL for a POSTed form:

## page2
<form method="post" action="page3.p hp?data=$urlenc oded_data">


Method is POST. Are you sure that he can obtain GET data in this case?

Jul 17 '05 #4
Dennis Biletsky wrote:

"Pedro Graca" <he****@hotpop. com>
[skip]
You can pass parameters in the URL for a POSTed form:

## page2
<form method="post" action="page3.p hp?data=$urlenc oded_data">


Method is POST. Are you sure that he can obtain GET data in this case?


Yes.

<form method="post" action="test.ph p?id=one">
<input type="text" name="id" value="two">
<input type="submit">
</form>

and on test.php you can do:

<?php
echo $_GET['id']; // one
echo $_POST['id']; // two, if it hasn't been changed
?>

If you use $_REQUEST['id'] it will get "one" or "two" depending on your
configuration.

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #5

"Pedro Graca" <he****@hotpop. com> / :
news:2h******** ****@uni-berlin.de...
Dennis Biletsky wrote:

"Pedro Graca" <he****@hotpop. com>
[skip]
You can pass parameters in the URL for a POSTed form:

## page2
<form method="post" action="page3.p hp?data=$urlenc oded_data">
Method is POST. Are you sure that he can obtain GET data in this case?


Yes.

<form method="post" action="test.ph p?id=one">
<input type="text" name="id" value="two">
<input type="submit">
</form>

and on test.php you can do:

<?php
echo $_GET['id']; // one
echo $_POST['id']; // two, if it hasn't been changed
?>

If you use $_REQUEST['id'] it will get "one" or "two" depending on your
configuration.


It works. Thanks. It is convenient. --
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :

Jul 17 '05 #6
> >
However, I get confused as to how I might be able to both submit this mini form and at the same time be able to forward on my previously gathered
results from the form on PAGE1.

Does this makes sense? If anyone could help me out here with *anything* at all that might help, I would be so grateful...


You can pass parameters in the URL for a POSTed form:

## page2
<form method="post" action="page3.p hp?data=$urlenc oded_data">
<input type="text" name="address">
<input type="submit">
</form>

## page3
mail('y******** ***@example.com ', 'form data with contact details',
"Someone entered this data:\n\n" .
"{$_GET['data']}\n\n" .
"The user details are:\n" .
" address: {$_POST['address']}");


Thanks - I'm halfway there, I think. I'm getting my POST data through to the
next page, but I'm not sure how or if I can use the URLENCODE command within
the form? Whereas I used to have the data passed on like so:

echo '<a href="mail.php? radiochoice=', urlencode($radi obutton),
'&radiomoderntr ad=', urlencode($radi omoderntrad),
'&radiocoord= ', urlencode($radi ocoord),
'&radiopacking= ', urlencode($radi opacking),
'&i1=', urlencode($item 1),
'&i2=', urlencode($item 2),
'&i3=', urlencode($item 3),
'&i4=', urlencode($item 4),
'&i5=', urlencode($item 5),
'&i6=', urlencode($item 6), ETC.

when I try to do a (obviously botched?!) cut and paste job to get the
following:

<form name="form1" method="post" action="finalte st.php?stevetes t=",
urlencode($item 1),' stevetest2=', urlencode($item 2),'">
<p>

<input type="text" name="textfield ">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>?>

I get a 'Parse error: parse error, unexpected '<'' - yes, my grasp is syntax
is pretty crappy, but I'm no programmer - just a GFX guy trying to learn!
Anyone able to help me mastering this last piece of my jigsaw?

THANKS!

Steve
Jul 17 '05 #7

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

Similar topics

11
2713
by: JKop | last post by:
Take the following simple function: unsigned long Plus5Percent(unsigned long input) { return ( input + input / 20 ); } Do yous ever consider the possibly more efficent:
12
4412
by: Jeff B. | last post by:
If an object implements the IDisposable interface, should I always call the Dispose method or is just setting it to null and letting the GC handle it sufficient? Here is the pattern I've been using but wasn't sure if it was necessary: DataAdapter da = null; try { // Some logic here... } catch (Exception ex) {
3
1754
by: John Baker | last post by:
Hi:7 Newby here to ASP, and using the ASP.NET Web Matrix development tool. While that tool looks great for a Newby, I have run into a snag. I have an HTML Text Box which I have named HireInput, and a table (Access Table in fact) that has on it a field called HIREID. I wish to select records where the two match! It sounds simple, but I am having trouble setting up the text box name so that it is recognized in the query. Can someone...
10
1945
by: Andrew | last post by:
Sorry about this but I'm new to ADO.NET (finally coming from simple ADO, bless it) and I'm trying to create a simple three tier program. Ie, User interface Layer / Business object layer / Database layer I've got a simple program that is activilly populating and writing my satasets. They are currently only mapping the database tables.So 1 dataset, 5 datatables and several relationships. In this program I can't seem to hide the database...
4
1146
by: Hexman | last post by:
I've been trying to figure ADO.net/VB/AccessDB out for some time. I've read many internet articles that have been pointed out to me by people in this group. Thanks for trying to help. I just can't get it. All I'm trying to do (in pseudo code) is: Open a table in Access. read a transaction from flat file until eof Build a query ("Select * from purord where ponum = 'flat file ponumber' ") execute query
15
4578
by: Bjoern Schliessmann | last post by:
Hello all, I'm trying to simulate simple electric logic (asynchronous) circuits. By "simple" I mean that I only want to know if I have "current" or "no current" (it's quite digital) and the only elements need to be (with some level of abstraction to my specific problem) - sources (here begin currents) - ground (here end currents)
3
7261
by: Shal | last post by:
Hi all, I have a table with 300,000 records in it and I want to run an update that has a few clauses in the WHERE command and just changes one boolean value on a subset of records. What I am curious about is the query, (if it works at all) takes ages to complete. I suppose 300,000 records is alot to process and I will sometimes want to change this boolean value on up to 20,000 of those, but I have had times of over an hour and it is still...
10
2134
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel <System.Web.Services.WebService(Namespace:="http:// wwwpreview.#deleted#.co.uk/~ptaylor/Customer.wsdl")_
7
1808
by: CSharper | last post by:
Yesterday I had a heated discussion with my colleagues on what is a data centric application and having business logic in sql. I have group of people who wants to include all the business logic in the sql stored proc and I for one consider to have most of the business logic in the C# code (specifically in a controller class of MVC). These are my points to them. 1. Our application depends a lot on the data and we have huge amount of data...
0
8979
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8818
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8234
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4589
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4860
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.