473,785 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

returning to signup form

hi

i have a basic signup POST form, with php on the same page. how do i
return to this page with all the entries still present, yet with a
message at the top, for when the user enters one invalid entry?

cheers
dave
Jul 17 '05 #1
3 2182

"David" <da********@gma il.com> schreef in bericht
news:f3******** *************** ***@posting.goo gle.com...
hi

i have a basic signup POST form, with php on the same page. how do i
return to this page with all the entries still present, yet with a
message at the top, for when the user enters one invalid entry?

cheers
dave


I consider you will write to a database in the same php page and then
redirect to another page

Put this in the top of your page:

if($Submit) { // Submit is the name of your submit button

if(!$name || !$street) { # if for example name or street not filled in
# generate errormessage
if(!$name) {$err .= "Name not filled in";}
if(!$street) {$err .= "Street not filled in";}
} else {

# alle input ok, here you can put your sql queries to interact
with the database

header("Locatio n: nextpage.php");
exit;
}

}

Marcel
Jul 17 '05 #2
While the city slept, David (da********@gma il.com) feverishly typed...
hi
Ay up,
i have a basic signup POST form, with php on the same page. how do i
return to this page with all the entries still present, yet with a
message at the top, for when the user enters one invalid entry?


If you are posting the results to the page, then write them into the default
values for the input elements. Something like;

<html>
<head>
<!-- head stuff here -->
</head>
<body>

<?php

$defaultName = "Enter your name here"
$defaultEmail = "Enter your email address here"
$formError = false;

if($_POST['update'] == 1) {
$name = $_POST['name'];
$email = $_POST['email'];
if(($name == "") || ($email == "")) {
$formError = true;
print("<p>Error on form.</p>");
if($name == "") {
print("<p>Pleas e enter a value for Name</p>");
}
else {
$defaultName = $name;
}
if($email == "") {
print("<p>Pleas e enter a value for Email Address</p>");
}
else {
$defaultEmail = $email;
}
}
else {
print("<p>Thank s for your input!</p>");
// write the form contents to your database, or whatever
}
}

if ((!isset($updat e)) || ($formError)) {
?>

<form action = "thispage.php?u pdate=1" method="post">
<p>Name: <input type="text" name="name" value="<?=$defa ultName?>"></p>
<p>Email Address: <input type="text" name="email"
value="<?=$defa ultEmail?>"></p>
<input type = "submit" name="submit" value="Submit">
</form>
<?
}
?>

</body>
</html>

.... Note: This is straight off the top of my head! Not tested or anything!

Hope that helps,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigen et.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #3
think i get it now. cheers guys

dave
Jul 17 '05 #4

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

Similar topics

6
4999
by: Rudi Ahlers | last post by:
I tried the following: http://intranet/signup.php?Domain=newdomain.com, and it doesn't seem to return any values In my script I have the following: <? print $_POST; $DomainName = $_POST; print $DomainName;
7
12294
by: deko | last post by:
Why is $_SERVER returning multiple IP Addresses? Actually, I'm not sure if it's $_SERVER -- or which if/else statement -- that's the problem, but what I'm getting as a value for $visip looks like this: 172.16.42.181, 62.138.35.94 Why am I getting more than one IP Address? Which IP is the originating IP Address? Is there a way to get only the originating IP?
3
1654
by: Dustin | last post by:
I am developing a website where users can sign up for a service. They essentially can become a memeber. It will allow anyone to sign up, but I need to make it so only humans can sign up. I need to avoid any automatic scripts that could create tons of bogus accounts. What I believe is the best solution for me is to have an image appear as part of the form they fill out to get the account. In the image will be scrambled text. The user...
2
1461
by: .Net Sports | last post by:
I need to find a script that whereas a user signs up for your website and when he hits submit, an email goes to his email box with a confirmation link (generated by random number) for him to click so to ensure he has a valid email address. Does anyone know of a package or series of scripts that works with this? I'm using CDO mail in ASP. Thanks netsports
0
1426
by: jon | last post by:
Hey, i've been trying to create a signup page that asks for a username, password and then to confirm the password. It is suppose to check how long both of them are, and if the passwords line up, that went well, but i can't make it check to see if it is being used by someone else. heres the script, good luck. / *************************signup.html*******************************************************************/ <fieldset> <form...
2
1145
by: fredtbx | last post by:
Using ASP.NET 2.0 Login control and CreateUserWizard Hi, I can't figure out how, when I have the Login control up on Login.aspx and if the user doesn't have an account, to point to Signup.aspx which has the CreateUserWizard on it. I have the site set up so trying to access any page without being authenticated brings you back to Login.aspx. How can I make it so from Login.aspx, if the user doesn't have an account yet, he can click a "Sign...
1
3254
by: kang jia | last post by:
hi when user entered particulars in signuppage and click" signup" button, i will direct them to do_signup.php. if say the NRIC is dupicate in datebase, i will redirect them back to signup page again to re-signup, however, i would like to remain all the correct infromation, and let users re-entered their NRIC. how can i do this. can i use Session, but it seems cant work. any one can help me? my code in signup page is like this: ...
2
1829
by: nazgul42 | last post by:
Ok... this is my third problem today, but here goes: On my signup page for my login system on my website, I have some code that is supposed to check if a username is already taken and give an error if it is. The problem is that I submit a set of values, and it works as expected. Then I submit the same set of values, and it enters them into the database anyways. this is my code: <?php session_name("SIGNUP"); session_start();...
0
1406
by: david220 | last post by:
hi once members sign up to my site they get sent an email which contains there username/password which they enter on a sign up form. Once they've signed up the email is automatically sent using the code below. The site uses classic asp and vbscript, with the email bit in cdonts. I recently changed hosts and they use cdosys. I have used cdosys email before but are'nt sure how to get it to connect to the asp bits they enter on the sign...
0
9647
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
9485
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
10356
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
10161
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...
0
9958
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...
1
7506
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
6743
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();...
1
4058
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
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.