Hello, a stupid question but...
page_A.php is a page with a form.
The user inserts text in four fields, then he clicks a submit button.
The data goes to page_B.php:
this page controls the data submitted, then echoes a message.
If there were problems with the submitted data the message says:
"a problem occurred with your data. Click here to come back to the
form" (page_A.php).
When the user comes back, he finds the fields white.
How can I do to show him what he submitted?
Thanks! 26 3889
..oO(pe******** *****@gmail.com )
>page_A.php is a page with a form. The user inserts text in four fields, then he clicks a submit button. The data goes to page_B.php: this page controls the data submitted, then echoes a message. If there were problems with the submitted data the message says: "a problem occurred with your data. Click here to come back to the form" (page_A.php). When the user comes back, he finds the fields white.
You don't need two pages. Let page_A show and handle the form
processing. Submit the form to the same page, check the values and show
the form again if there's an error.
To keep the form data while moving from one page to another you would
have to store the values in a session.
Micha
On Sep 14, 6:39 pm, Michael Fesser <neti...@gmx.de wrote:
To keep the form data while moving from one page to another you would
have to store the values in a session.
Micha
Ok, I'll use sessions, thanks! pe************* @gmail.com wrote:
Hello, a stupid question but...
page_A.php is a page with a form.
The user inserts text in four fields, then he clicks a submit button.
The data goes to page_B.php:
this page controls the data submitted, then echoes a message.
If there were problems with the submitted data the message says:
"a problem occurred with your data. Click here to come back to the
form" (page_A.php).
When the user comes back, he finds the fields white.
How can I do to show him what he submitted?
Thanks!
Create a form on page B. Copy all of the $_POST variables into hidden
fields with a submit button that says, "Go Back."
--
*************** **************
Chuck Anderson • Boulder, CO http://www.CycleTourist.com
*************** **************
If you put them in the same page, it will be better for you. It will
ease the process.
[PHP]
if (isset($_POST['submit'])) {
# Process the form
if ($number_of_err ors_in_the_form != 0) {
# Show the errors
# Display the Form Again.
# Example: print "<input type='text' name='fieldname ' value='".
$_POST['fieldname']."' />";
} else {
# Tell the user everything went fine.
}
} else {
# Display the form.
}
>
Create a form on page B. Copy all of the $_POST variables into hidden
fields with a submit button that says, "Go Back."
hi chuck, it sounds interesting (I imagine form on page B should point
page A), but what if the user clicks the back button of his browser? pe************* @gmail.com wrote:
>Create a form on page B. Copy all of the $_POST variables into hidden fields with a submit button that says, "Go Back."
hi chuck, it sounds interesting (I imagine form on page B should point
page A), but what if the user clicks the back button of his browser?
Yes, the form action on page B is to return to page A.
Clicking the Back button is fine. The browser loads the previous state
of page A, with the form fields still filled out.
I've even written a function that reads all of the elements in an array
(e.g., $_POST) and creates hidden form fields for each one. It can even
handle multi-dimensional arrays (e.g., $_POST variables that are
themselves, an array).
--
*************** **************
Chuck Anderson • Boulder, CO http://www.CycleTourist.com
The world is my country,
Science, my religion.
*************** **************
Chuck Anderson wrote:
pe************* @gmail.com wrote:
>>Create a form on page B. Copy all of the $_POST variables into hidden fields with a submit button that says, "Go Back."
hi chuck, it sounds interesting (I imagine form on page B should point page A), but what if the user clicks the back button of his browser?
Yes, the form action on page B is to return to page A.
Clicking the Back button is fine. The browser loads the previous state
of page A, with the form fields still filled out.
It will if you have the browser caching the page and haven't needed to
flush the cache. But you shouldn't depend on that behavior.
I've even written a function that reads all of the elements in an array
(e.g., $_POST) and creates hidden form fields for each one. It can even
handle multi-dimensional arrays (e.g., $_POST variables that are
themselves, an array).
That's the best way to handle things.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
I've even written a function that reads all of the elements in an array
(e.g., $_POST) and creates hidden form fields for each one. It can even
handle multi-dimensional arrays (e.g., $_POST variables that are
themselves, an array).
Chuck, this sound really interesting, simple and powerful too:
at the moment, page B converts every key in a variable of the same
name:
foreach($_POST as $k =$v){
if(in_array($k, $required_keys) &&(trim($_PO ST[$k]!=''))){
${$k}=$v;
$count++;
}
}
it would be quite easy to use this foreach to build my fields :-)
Thanks!
Little problem in page A, now:
I imagine I must verify if I have 'something' in $_POST
(I get an Undefined Variable notice when I directly write:
if($_POST[$k]!=''){
${$k}=$v;
}
and I access this page for the first time, that is when for sure there
is nothing in $_POST
)
I tried
if(array_key_ex ists(etc. but this way I must write code for any
possible key...
Is there a handy way to know if there is 'something' in $_POST?
Thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric |
last post by:
Hey Everyone..
I have a form that has approximately 7 text fields and 1 checkbox.
Generally when this form is submitted(to itself BTW) it works fine,
however, when the checkbox is only field that has been
modified/clicked the form doesn't always submit. When it does work, a
Stored procedure is passed form variables and updates to the db are
made. When it doesn't, its as if the form wasn't submitted, it
reloads and resets the page, but...
|
by: Dan R Brown |
last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to
break up this form into several "tabbed" sections, I break up the form using <div>
tags. Each <div style="display:none"> can be displayed by setting the style attribute
to "display:", or hidden with "display:none". This gives the illusion that the person
filling out the form is switching from page to page...without the overhead of extra
hits on the server,...
|
by: Rick |
last post by:
Hello,
I'm having trouble with submitting my form when checking to see if data
is present in the user-inputted fields. What I want to happen is for
the user to input various pieces of data, submit the form, and then
have a javascript function that checks to see if data is entered, and
if not, have an alert window tell the user which field to enter data
into and then revert back to that same page. If all data is entered,
it would...
|
by: Wysiwyg |
last post by:
I need to validate a form to ensure that all of the fields add up correctly.
I can't do this while the user is entering data since validation needs to be
done after the entry is completed. What's the "best" way to validate prior
to submitting?
I could add an onsubmit attribute to the form which executes the validation
in Javascript. That way the response doesn't need to be sent before
validation takes place. Is this pretty much the way...
|
by: Esa |
last post by:
Hi,
I'm having problems with one strange web system where submitting an
application and making queries about its handling status require a series of
form submits and response parsing - all in HTML. Luckily other interfaces
are "modern" using xml file up/downloads without any difficulties...
I'm not very used to .NET-environment yet, so I'd appreciate some clues
about the classes I should use to implement this stupid interface - stupid...
| |
by: Rik |
last post by:
Hello guys,
now that I'm that I'm working on my first major 'open' forms (with
uncontrolled users I mean, not a secure backend-interface), I'd like to add
a lot of possibilities to check wether certain fields match certain
criteria, and inform the user in different ways when the data is wrong
(offcourse, this will be checked on posting the data again, but that's
something I've got a lot of experience with).
Now, offcourse it's...
|
by: kev |
last post by:
Hi all,
I have created a database for equipments. I have a form to register the
equipment meaning filling in all the particulars (ID, serial, type,
location etc). I have two buttons at the end of the form which is
submit and cancel. After i have clicked submit, the information is
stored directly into my corresponding database table. My problem here
is i need to retrieve back the information submitted to display all the
data that the...
|
by: NavinM |
last post by:
I have a couple of forms that are misbehaving in FireFox, but work fine in IE.
when i do submit( with submit button) a javascript function validates all of the fields entered, and stops the submission if there is an error.
Sample (obviously not working code):
<html>
<head>
<script type="text/javascript">
function Submit()
{
|
by: flexsingh |
last post by:
Hello there, I have a form and when data is inputted it goes into the table and I can get it out pefectly fine, the problem I have is that if the promary key is empty it will not submit, but if any of the other fields are empty except the primary key then the forms submits.
Is there a way to stop the form submitting unless all the fields are filled in first?
<?php
// this starts the session
session_start();
?>
<?php
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |