473,750 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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('regist er2.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 2146
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($erro r). 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******** *************@a uth.uk.news.eas ynet.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('regist er2.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
2095
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 the player's input in the game. I had visited many sites having c++ tutorials but no one gave enough explanation about this. an anyone please help me?
14
3110
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 ; ExpenseType Data: 1 ; FOOD 2 ; AIRLINE 3 ; FARE
4
16278
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 to use javascript to submit the document via the browser's DOM. <form action='loginScript.cgi' method="post" name="loginForm">
66
5398
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 occurs. After the program has read the file, it should offer a menu with three choices. the first is to list all the words along with the number of occurences. The second is to let you enter a word, with the program reporting how many times the...
8
3165
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. The link to the document is http://www.surveymonkey.com/s.asp?u=689952259313 I have spent 15 hours trying to sort this but to no avail.
4
1886
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 number in the interval and then calculates the natural logarithm of that number using this series with 6 decimal places accuracy (you can use the alternating harmonic series program as a template).
0
965
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
1560
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 bumped that number to 99999999 (see below). Can anyone please tell me if (1) my config files below look ok, and (2) you have any other ideas why things might be so slow? Thanks VERY much for any feedback, Ron
0
8999
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, 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...
0
9575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
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 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...
1
9338
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8260
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 project—planning, coding, testing, and deployment—without 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...
1
6803
isladogs
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...
0
6080
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
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2223
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.