Hi,
I am not sure if this is a HTML or PHP problem, so please bear with me.
I have a PHP/HTML script to create and update records in a database.
On page1.php, I ask the user for a reference number. Pressing Submit button
launches page2.php
On page2.php I check that this is unique and if so, I create a new record in
the database. On the same page, I ask the user to complete the remainder of
the fields. Press Submit button to take you to page 3.
On page 3, I need to update the database record with the newly completed
fields. The problem is that the variable (reference number) I created in
page 1 is not carried to page 3. So the update doesn't happen.
Can anyone give me some help on how to get around this.
Apache 1.3.8, PHP 4
Thanks
Martyn
--
Martyn
(remove the 2nd "Y" to reply) 5 1868
KM wrote: Hi,
I am not sure if this is a HTML or PHP problem, so please bear with me.
I have a PHP/HTML script to create and update records in a database. On page1.php, I ask the user for a reference number. Pressing Submit button launches page2.php On page2.php I check that this is unique and if so, I create a new record in the database. On the same page, I ask the user to complete the remainder of the fields. Press Submit button to take you to page 3. On page 3, I need to update the database record with the newly completed fields. The problem is that the variable (reference number) I created in page 1 is not carried to page 3. So the update doesn't happen.
Can anyone give me some help on how to get around this.
Apache 1.3.8, PHP 4
Thanks
Martyn
Add the reference number as a hidden form field in page 2, and get it in
page 3. Then you can carry it around with you!
--
Thanks,
Elliott C. Bäck
--------------------------------- www.elliottback.com/blog/ www.spreadIE.com
"KM" <ma****@czd.orgy.uk> wrote in message
news:10***************@sabbath.news.uk.clara.net.. . Hi,
I am not sure if this is a HTML or PHP problem, so please bear with me.
I have a PHP/HTML script to create and update records in a database. On page1.php, I ask the user for a reference number. Pressing Submit
button launches page2.php On page2.php I check that this is unique and if so, I create a new record
in the database. On the same page, I ask the user to complete the remainder
of the fields. Press Submit button to take you to page 3. On page 3, I need to update the database record with the newly completed fields. The problem is that the variable (reference number) I created in page 1 is not carried to page 3. So the update doesn't happen.
Can anyone give me some help on how to get around this.
Apache 1.3.8, PHP 4
Thanks
Martyn
-- Martyn
(remove the 2nd "Y" to reply)
Try using a hidden field in page2.php's form. For example, if you named the
reference number textbox "refnum", put this line in your form in page2.php:
<input type="hidden" name="refnum" value="<?php print $_REQUEST['refnum'];
?>">
Then, on page3.php, access the reference number using $_REQUEST['refnum'].
(Or use $_POST/$_GET depending on what method you're using.)
- JP
KM wrote: Hi, Can anyone give me some help on how to get around this.
I have managed to do this using cookies - not ideal but got me out of a
hole.
But any other suggestions would be welcomed
--
Martyn
KM wrote: [...] The problem is that the variable (reference number) I created in page 1 is not carried to page 3. So the update doesn't happen.
Can anyone give me some help on how to get around this.
Save the reference number in a session variable.
<?php // page1.php
session_start();
$_SESSION['ref_number'] = '123456';
// ... whatever
echo '<a href="page2.php">go to page 2</a>';
?>
<?php // page2.php
// ... whatever
echo '<a href="page3.php">go to page 3</a>';
?>
<?php // page 3
session_start();
echo 'Reference number: ', $_SESSION['ref_number'];
?>
--
USENET would be a better place if everybody read: http://www.expita.com/nomime.html http://www.netmeister.org/news/learn2quote2.html http://www.catb.org/~esr/faqs/smart-questions.html
KM wrote: I have managed to do this using cookies - not ideal but got me out of a hole. But any other suggestions would be welcomed
As someone else suggested, go with sessions. The problem with hidden variables
and cookies is that they can easily be faked. For instance, if you have
reference numbers 235, 345 and 111 in your db, then I could go directly to page
2 with http://yourdomain.com/page2.php?refnum=111 and change values that are
already there from another user. Or, with slightly more work, I could write a
PHP script to go directly to page 2 while sending a cookie containing the
number.
And, as a side note, I hope you have a good reason for making the user enter a
reference number (i.e. it applies to an existing reference number from another
system, etc.). I hope you're not just making them think of one so you don't
have to code it. :o)
Shawn
--
Shawn Wilson sh***@glassgiant.com http://www.glassgiant.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roger Smythe |
last post by:
A means for the progressive decomposition a problem space into increasingly simpler component parts
such that these component parts represent higher levels of conceptual abstraction, and are...
|
by: user |
last post by:
Hi all,
At the outset, I regret having to post this slightly OT post here.
However, I strongly feel that people in this group would be the best to
advise me on my predicament.
I am working as...
|
by: evolnet.regular |
last post by:
I've been utilising C for lots of small and a few medium-sized personal
projects over the course of the past decade, and I've realised lately
just how little progress it's made since then. I've...
|
by: Kevin Spencer |
last post by:
Is it just me, or am I really observing a trend away from analysis and
probem-solving amongst programmers? Let me be more specific:
It seems that every day, in greater numbers, people are coming...
|
by: bambooforest |
last post by:
Hi all,
I'm from a Linguistics background and am new(er) to programming. Could
someone recommend a book or resource that teaches programming aspects
with Python? Python I hear is a very...
| |
by: Michael |
last post by:
Hey, I'm, I guess, an itermediate programmer and I have a question about
learning any programming language. I understand that as a programmer you're
going to probably constantly be re-writing code...
|
by: stylecomputers |
last post by:
Hey guys,
I am absolutely new to Linux programming, with no w######s programming
experience except a small amount of C++ console apps.
Reasonably new to Linux, BSD etc, got good sound networking...
|
by: arnuld |
last post by:
hai all,
1st of all this post is not about C++, it is about general programming,
problems i am facing in learning the concepts & reflects my experience
with C and C++ . i know about functions,...
|
by: Enteng |
last post by:
Hi I'm thinking about learning C as my first programming language.
Would you recommend it?
Also how do you suggest that I learn it?What books/tutorials should I
read for someone like me?
Thanks...
|
by: Banfa |
last post by:
I felt that this was a good point to start a tutorial on C/C++ programming because clearly we need to have some idea of what we are trying to achieve before we start out. I recently found this...
|
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,...
| |
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: 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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
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...
| |