473,385 Members | 1,642 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,385 software developers and data experts.

designing source code for multiple forms

Hi
I want to start writing a new site. It will include 3 forms that will
collect information from the user. I know how to keep the info in
sessions etc. my question is about the design of the server side php
files. I don't want to design all three forms in one big file, id
rather have a separate php file for each form.

Say I have a file form1.php which creates the initial form, should I
say (form1 action="form1.php") and have the form validation code in
form1.php? If so how do I call form2.php from inside form1.php? Or do I
say(form1 action ="form2.php") and have my validation code for form 1
inside form2.php if so how do I call back form1 if validation fails

now this has been asked already (see link below)and it was suggested to
use the include() require() functions. but then others have argued
against it. so is includeonce() the most practical way or should I
rather write all the code in to one big index.php

Jul 17 '05 #1
2 1823

now this has been asked already (see link below)and it was suggested to use the include() require() functions. but then others have argued
against it. so is includeonce() the most practical way or should I
rather write all the code in to one big index.php


sorry i forgot to include the link, here you go

http://groups-beta.google.com/group/...k+to+Search&&d

Jul 17 '05 #2
ggg
I can't think of a good reason for either case -- wether you have
separate files for each section, or have one big file. That's why I'd
say it's more of stylistic issue.

That said, I'd argue for multiple pages, because, to me, it fits in
better with the logical flow of what you want to do. Like another guy
said in that old thread - I like the one-to-one correlation between
script and URL.

I typically have my form validation on the same page. Here's a sketch of
what I'm thinking. In form1.php:

<?

// if it's valid submitted data, go to step 2
if (isValid())
header();
?>

<form action="form1.php" method="POST">
<!--- the form elements -->
</form>
....then in form2.php you could store the passed variables in a <input
type="hidden"> fields.

...then if you have problems, and the user has to go back to form1.php
you have those form1 varaiables tracked.

It sounds like you want to avoid passing everything around? I guess you
could use sessions, as you mentioned or, cookies.
In article <11**********************@c13g2000cwb.googlegroups .com>,
yo******@yahoo.com says...
Hi
I want to start writing a new site. It will include 3 forms that will
collect information from the user. I know how to keep the info in
sessions etc. my question is about the design of the server side php
files. I don't want to design all three forms in one big file, id
rather have a separate php file for each form.

Say I have a file form1.php which creates the initial form, should I
say (form1 action="form1.php") and have the form validation code in
form1.php? If so how do I call form2.php from inside form1.php? Or do I
say(form1 action ="form2.php") and have my validation code for form 1
inside form2.php if so how do I call back form1 if validation fails

now this has been asked already (see link below)and it was suggested to
use the include() require() functions. but then others have argued
against it. so is includeonce() the most practical way or should I
rather write all the code in to one big index.php

Jul 17 '05 #3

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

Similar topics

115
by: TheAd | last post by:
At this moment I use MsAccess and i can build about every databound application i want. Who knows about a serious open source alternative? Because Windows will be a client platform for some time, i...
6
by: Gary James | last post by:
This may not be a direct C# question, but since I'll be using using C# for development, I thought I'd pose the question here. I'll soon be involved in the design of a new software product that...
7
by: MuZZy | last post by:
HI, We have a pretty large application with hundreds of forms in it. Now some of our new clients request us to make some custom screens(forms), which basicly comes to rearranging controls on our...
3
by: PaulWilson | last post by:
I've finally decided to make my WilsonWebForm open-source on SourceForge at http://sourceforge.net/projects/wilsonwebform/: The ASP.NET WilsonWebForm enables Multiple Forms and Non-PostBack...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
7
by: John J. Hughes II | last post by:
I have a DataGridView with a TextBoxColumn. I setting the data source to a List<stringvalue in a static class. The list is filled from a background thread. So far all is fine and it works...
32
by: keri | last post by:
Hi everyone, Having learnt a little about the basics whilst creating my first db I am now about to start creating a good one! I am about to sit down with a large piece of paper and plan it all...
9
by: pereges | last post by:
Hello I need some ideas for designing a recursive function for my ray tracing program. The idea behind ray tracing is to follow the electromagnetic rays from the source, as they hit the...
0
by: fjm | last post by:
I am having a bit of a problem getting my head around how to handle a design issue and hope that someone can offer some assistance. I am making a front end to a mysql database in PHP. I am at the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...

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.