473,394 Members | 1,749 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.

Can anyone offer a solution to a POST'ing problem please

Hi all,

I have a page named register.php, which is a form for collecting user data.
As an example:
- I have the fields Name, Surname, email.
- In the <form> tag I have action =""
- The page register.php has a condition
if (isset($_POST['submit'])) {
include('register2.php');
}
- the file register2.php does the error checking etc.
- I am using sessions and they do work as I can get this page to work using
various methods except for when I display the errors on the same page.

The Problem:
If a user John, Smith, jo**@smith.com fills in the form but leaves the
surname blank. A message is displayed on the same page telling him the
surname is required. If, however, he changes the first name to Johnny but
still leaves the surname blank, clicking the submit button displays the
surname error, and his first entry (John) in the name field, clicking the
submit button again, with the surname blank, displays the error message but
displays Johhny in the name field. Subsequent submits with the missing
surname makes the first name alternate between John and Johnny.
I have an understanding of the POST process and know that I can display a
different page for the error message, with a 'return' button/anchor to
resolve this issue but does anyone know of a solution, using the above
setup, whereby I can display the error on the same page and prevent the user
variables from swapping It's a big question but TIA.

Jul 17 '05 #1
1 2125
Oops, I was too impatient/fustrated. I have managed to find a solution. I
don't know if it is the best one.
For anyone who is interested: I redirected to register.php on an error,
which solved the displaying of information in the text fields.
A new problem arose which is that I could not display error messages as my
errors work by each error that occurs assigning a value to the variable
$error. A function is called at the end of the register2 which formats and
displays the error i.e. error_box($error). Using the redirect made me think
I had messed up the error handling but I session registered $error and all
is well.

Sorry for the monologue guys/girls but I have just surface after a year of
programming.
"Mr Mint" <mi***@home.com> wrote in message
news:3f*********************@auth.uk.news.easynet. net...
Hi all,

I have a page named register.php, which is a form for collecting user data. As an example:
- I have the fields Name, Surname, email.
- In the <form> tag I have action =""
- The page register.php has a condition
if (isset($_POST['submit'])) {
include('register2.php');
}
- the file register2.php does the error checking etc.
- I am using sessions and they do work as I can get this page to work using various methods except for when I display the errors on the same page.

The Problem:
If a user John, Smith, jo**@smith.com fills in the form but leaves the
surname blank. A message is displayed on the same page telling him the
surname is required. If, however, he changes the first name to Johnny but
still leaves the surname blank, clicking the submit button displays the
surname error, and his first entry (John) in the name field, clicking the
submit button again, with the surname blank, displays the error message but displays Johhny in the name field. Subsequent submits with the missing
surname makes the first name alternate between John and Johnny.
I have an understanding of the POST process and know that I can display a
different page for the error message, with a 'return' button/anchor to
resolve this issue but does anyone know of a solution, using the above
setup, whereby I can display the error on the same page and prevent the user variables from swapping It's a big question but TIA.

Jul 17 '05 #2

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

Similar topics

6
by: Kartik | last post by:
Hello, I was trying to develop a game in c++ ( text mode ), but I couldn't figure out how to make rest of the elements moving in the game while waiting for the player's input, or, how to accept...
14
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ;...
4
by: dschruth | last post by:
Hello. Can anybody solve this problem? I am using a server-side language (PERL) to *try* to POST data to a HTTPS login script that doesn't have a standard "submit" button. The form appears...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
8
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it....
4
by: skatemore9690 | last post by:
#1 in Calculus you learned that log(1+x) = x - x^2/2 + x^3/3 - x^4/4 + ... for x in the interval (-1,1] (here x^2 means "x squared", etc.). Write a program which asks the user to type a...
0
by: sajithamol | last post by:
Can anyone please tell me how to implement AT commands in .NET for sending and receiving SMS through GSM modem/mobile connected to a PC.
1
by: Ronald S. Cook | last post by:
Performance in our WCF application is very poor now that we've added a number of records to tables (not an unrealistic number, though). After doing that, we did get "max message size" errors to I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.