Re: [PHP] multiple forms one page

2012-08-27 Thread Tedd Sperling
On Aug 27, 2012, at 12:08 AM, Rosie Williams rosiemariewilli...@hotmail.com 
wrote:

 
 Hi all, 
 I am a newbie to PHP. I have several php forms which were originally on 
 separate pages now included in the one page. Each form had the following code 
 in it: 
 function mysql_fix_string($string){   if (get_magic_quotes_gpc()) $string = 
 stripslashes($string);return mysql_real_escape_string($string);}
 function mysql_entities_fix_string($string){  return 
 htmlentities(mysql_fix_string($string));}
 However I am only able to include it in one of the forms on the new page with 
 multiple scripts due to the fatal error that I can only declare the function 
 once. So for testing I have commented these lines out of the other scripts. I 
 need to know what the security implications of this are? Do the scripts that 
 do not contain these lines run without it or is it included automatically 
 every time the database is accessed regardless of which script is accessing 
 it? 
 If not how do I deal with it? 
 thanks in advanceRosie  


My advice -- place your common functions into one file (i.e., functions.php) 
and:

include_once(includes/functions.php);

At the start of every script that needs any of the functions contained therein.

As for rolling several forms into one, here are some of the ways I do it:

http://sperling.com/php/step/

http://sperling.com/php/submit/

Cheers,

tedd

PS: If anyone see's anything in error, please feel free to correct me. As a 
very talented harmonica player once said Sometimes I suck and sometime I blow.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multiple forms one page

2012-08-26 Thread tamouse mailing lists
On Sun, Aug 26, 2012 at 11:08 PM, Rosie Williams
rosiemariewilli...@hotmail.com wrote:

 Hi all,
 I am a newbie to PHP. I have several php forms which were originally on 
 separate pages now included in the one page. Each form had the following code 
 in it:
 function mysql_fix_string($string){ if (get_magic_quotes_gpc()) $string = 
 stripslashes($string);return mysql_real_escape_string($string);}
 function mysql_entities_fix_string($string){return 
 htmlentities(mysql_fix_string($string));}
 However I am only able to include it in one of the forms on the new page with 
 multiple scripts due to the fatal error that I can only declare the function 
 once. So for testing I have commented these lines out of the other scripts. I 
 need to know what the security implications of this are? Do the scripts that 
 do not contain these lines run without it or is it included automatically 
 every time the database is accessed regardless of which script is accessing 
 it?
 If not how do I deal with it?
 thanks in advanceRosie

Hi, Rosie, welcome!

This is something you will likely encounter again, so it is good to
learn it now.

You can put the two functions into another php file, and include that
file in your main script using include_once or require_once (there is
a difference that you might want to read up on at some point). If you
include this before you start your form processing, the functions will
be available to you at the point you need them. You only need do this
once in the php script where you will be using them, so you can safely
delete all the other occurances of the function definitions.

The nice part is, really, that you can use that same include file in
other projects as you go along, saving retyping the code. This is
something that you may want to think about for other such functions as
well. Modularity and code reuse are one of the big ways to achieving
more efficiency in your work.

http://us.php.net/manual/en/function.include-once.php
http://us.php.net/manual/en/function.require-once.php
(cf. http://us.php.net/manual/en/function.require.php to learn how the
require differs from the include)


Best of luck,

Tamara
   aka tamouse__

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multiple forms one page

2012-08-26 Thread Adam Richardson
On Mon, Aug 27, 2012 at 12:08 AM, Rosie Williams
rosiemariewilli...@hotmail.com wrote:

 Hi all,
 I am a newbie to PHP. I have several php forms which were originally on 
 separate pages now included in the one page. Each form had the following code 
 in it:
 function mysql_fix_string($string){ if (get_magic_quotes_gpc()) $string = 
 stripslashes($string);return mysql_real_escape_string($string);}
 function mysql_entities_fix_string($string){return 
 htmlentities(mysql_fix_string($string));}
 However I am only able to include it in one of the forms on the new page with 
 multiple scripts due to the fatal error that I can only declare the function 
 once.

You only have to declare the function(s) once, then you can use them
later in the page. You can also put code into files and then
dynamically include them in other files to make it easier to share
functionality.

 So for testing I have commented these lines out of the other scripts. I need 
 to know what the security implications of  this are?

For security, the simple rule (at least in terms of statement of
intent, not necessarily in terms of implementation) is that you should
validate input and escape output according to context. Without seeing
more code, it's hard to tell what this means for your particular
example.

 Do the scripts that do not contain these lines run without it or is it 
 included automatically every time the database is accessed regardless of 
 which script is accessing it?
 If not how do I deal with it?
 thanks in advanceRosie

Hard to know from your example. There are some great resources
covering general PHP security practices that can help you get up to
speed a bit. Here's an oldie but goodie that might help shed some
light on some of the code you're seeing:
http://www.ibm.com/developerworks/opensource/library/os-php-secure-apps/index.html

Happy learning!

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] multiple FORMS on same page problem.

2003-09-17 Thread Ruessel, Jan
You could also redirect with javascript:

echo Script Lang=javascript;
echo window.location.href = 'page5.php';
echo /script;

Grtz
Jan

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 16. September 2003 18:06
To: Golawala, Moiz M (IndSys, GE Interlogix)
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] multiple FORMS on same page problem.


Golawala, Moiz M (IndSys, GE Interlogix) wrote:

 It is almost working.. I can't figure out why I can get the someVal to page5.php.
 
 file: page4.php
 
 ?php
 
 if (isset($_REQUEST['submit1'])){
  echo button 1 was clicked, act accordingly;
  echo this the request values;
  echo $_REQUEST['someVal'];
 }elseif(isset($_REQUEST['submit2'])){
  session_start();
  echo button 2 was clicked, act accordingly;
  $_SESSION['post'] = $_POST;
  header(Location: http://127.0.0.1/Alarms/page5.php??=SID?);  

header(Location: http://127.0.0.1/Alarms/page5.php?; . SID);   

But this is not going to work. You can only redirect with header() if 
there has not been any output. That's why you are getting the errors.

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] multiple FORMS on same page problem.

2003-09-16 Thread Golawala, Moiz M (IndSys, GE Interlogix)
It is almost working.. I can't figure out why I can get the someVal to page5.php.

file: page4.php

?php

if (isset($_REQUEST['submit1'])){
 echo button 1 was clicked, act accordingly;
 echo this the request values;
 echo $_REQUEST['someVal'];
}elseif(isset($_REQUEST['submit2'])){
 session_start();
 echo button 2 was clicked, act accordingly;
 $_SESSION['post'] = $_POST;
 header(Location: http://127.0.0.1/Alarms/page5.php??=SID?);
}else{
 echo NO button clicked, do not act accordingly;  
}
?
html
form action=page4.php method=post
?php echo this is page 4; ?
input type=text name='someVal' value=''
input type='submit' name=submit1 value='page4 Submit'
/form


form action=page4.php method=post
input type='submit' name=submit2 value='page5 Submit'
/form
/html


file: page5.php
?php
$_POST = $_SESSION['post'];
$val = $_POST['someVal'];
echo $val;
echo this is page 5;
?

for some reason I get the error that the header was already sent. I have to send the 
session Id to the next page the old fashioned way since I have another problem that 
causes a new session to be created everytime a page is loaded. Do you where the 
problem is?

Thanx
Moiz

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Monday, September 15, 2003 4:36 PM
To: Golawala, Moiz M (IndSys, GE Interlogix); [EMAIL PROTECTED]
Subject: Re: [PHP] multiple FORMS on same page problem.


You can only use one form, as you've figured out. You can have PHP determine
the action for each button, though..

In a form with two buttons, say names submit1 and submit2, only one
variable will be set when the form is submitted, the actual button that was
clicked. So you can use logic like this in PHP.

?php
if(isset($_REQUEST['submit1']))
{ echo button 1 was clicked, act accordingly; }
elseif(isset($_REQUEST['submit2']))
{ echo button 2 was clicked, act accordingly; }
else
{ echo no button clicked, do not act accordingly?; }

So this would be in page4.php. $_REQUEST['someVar'] would be available
here.

Now, you want to redirect to page5.php if button two is pressed, right,
yet retain the value of $_POST?

if(isset($_REQUEST['submit2']))
{
$_SESSION['post'] = $_POST;
header(Location: http://www.yourdomain.com/page5.php;);
}

Now, on page5.php, to get $_POST back, just do:

$_POST = $_SESSION['post'];

That's assuming you have session_start() on each page and you don't have
anything in $_POST already on page5.php that you want to retain.

---John Holmes

PS: Sorry for the top-post, but OExpress sucks. :)


- Original Message - 
From: Golawala, Moiz M (IndSys, GE Interlogix) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 4:17 PM
Subject: [PHP] multiple FORMS on same page problem.


I am creating a page with 2 buttons. One which will refresh the page and the
other that will go to another page. My problem that I need to put all the
values into $_POST and have access to when any of the 2 buttons are clicked.
If I use the button in 2 seperate form tags I don't have access to all the
values in $_POST. Please look at the code below:

file (page4.php):

html

form action=page4.php method=post
?php echo this is page 4; ?
input type=text name='someVal' value=''
input type='submit' value='page4 Submit'
/form
form action=page5.php method=post
input type='submit' value='page5 Submit'
/form
/html

file(page5.php):

?php
$val = $_POST['someVal'];
echo $val;
echo this is page 5;
?

I would like to see the variable 'someVal' in the $_POST of both page4
Submit button and page5 Submit button. This code is a simplified version
of the more complecated code where a tonnes of other values are involved.
Any help is appreciated.

Moiz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multiple FORMS on same page problem.

2003-09-16 Thread John W. Holmes
Golawala, Moiz M (IndSys, GE Interlogix) wrote:

It is almost working.. I can't figure out why I can get the someVal to page5.php.

file: page4.php

?php

if (isset($_REQUEST['submit1'])){
 echo button 1 was clicked, act accordingly;
 echo this the request values;
 echo $_REQUEST['someVal'];
}elseif(isset($_REQUEST['submit2'])){
 session_start();
 echo button 2 was clicked, act accordingly;
 $_SESSION['post'] = $_POST;
 header(Location: http://127.0.0.1/Alarms/page5.php??=SID?);
header(Location: http://127.0.0.1/Alarms/page5.php?; . SID);		

But this is not going to work. You can only redirect with header() if 
there has not been any output. That's why you are getting the errors.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] multiple FORMS on same page problem.

2003-09-15 Thread Vail, Warren
I don't know of any rule that says you cannot have two submit button in the same form.

Of course, if you need to know which was clicked, you will either need to name them 
differently or detect their values in your form processing routine.  If the button is 
clicked that should take you to another form simply do a redirect (after processing 
all $_POST information);

header(Location: new page);
exit;   // I always use this because 
processing continues after header

good luck,

Warren Vail

-Original Message-
From: Golawala, Moiz M (IndSys, GE Interlogix)
[mailto:[EMAIL PROTECTED]
Sent: Monday, September 15, 2003 1:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP] multiple FORMS on same page problem.


I am creating a page with 2 buttons. One which will refresh the page and the other 
that will go to another page. My problem that I need to put all the values into $_POST 
and have access to when any of the 2 buttons are clicked. 
If I use the button in 2 seperate form tags I don't have access to all the values in 
$_POST. Please look at the code below:

file (page4.php):

html

form action=page4.php method=post
?php echo this is page 4; ?
input type=text name='someVal' value=''
input type='submit' value='page4 Submit'
/form
form action=page5.php method=post
input type='submit' value='page5 Submit'
/form
/html

file(page5.php):

?php
$val = $_POST['someVal'];
echo $val;
echo this is page 5;
?

I would like to see the variable 'someVal' in the $_POST of both page4 Submit button 
and page5 Submit button. This code is a simplified version of the more complecated 
code where a tonnes of other values are involved. Any help is appreciated. 

Moiz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multiple FORMS on same page problem.

2003-09-15 Thread CPT John W. Holmes
You can only use one form, as you've figured out. You can have PHP determine
the action for each button, though..

In a form with two buttons, say names submit1 and submit2, only one
variable will be set when the form is submitted, the actual button that was
clicked. So you can use logic like this in PHP.

?php
if(isset($_REQUEST['submit1']))
{ echo button 1 was clicked, act accordingly; }
elseif(isset($_REQUEST['submit2']))
{ echo button 2 was clicked, act accordingly; }
else
{ echo no button clicked, do not act accordingly?; }

So this would be in page4.php. $_REQUEST['someVar'] would be available
here.

Now, you want to redirect to page5.php if button two is pressed, right,
yet retain the value of $_POST?

if(isset($_REQUEST['submit2']))
{
$_SESSION['post'] = $_POST;
header(Location: http://www.yourdomain.com/page5.php;);
}

Now, on page5.php, to get $_POST back, just do:

$_POST = $_SESSION['post'];

That's assuming you have session_start() on each page and you don't have
anything in $_POST already on page5.php that you want to retain.

---John Holmes

PS: Sorry for the top-post, but OExpress sucks. :)


- Original Message - 
From: Golawala, Moiz M (IndSys, GE Interlogix) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 4:17 PM
Subject: [PHP] multiple FORMS on same page problem.


I am creating a page with 2 buttons. One which will refresh the page and the
other that will go to another page. My problem that I need to put all the
values into $_POST and have access to when any of the 2 buttons are clicked.
If I use the button in 2 seperate form tags I don't have access to all the
values in $_POST. Please look at the code below:

file (page4.php):

html

form action=page4.php method=post
?php echo this is page 4; ?
input type=text name='someVal' value=''
input type='submit' value='page4 Submit'
/form
form action=page5.php method=post
input type='submit' value='page5 Submit'
/form
/html

file(page5.php):

?php
$val = $_POST['someVal'];
echo $val;
echo this is page 5;
?

I would like to see the variable 'someVal' in the $_POST of both page4
Submit button and page5 Submit button. This code is a simplified version
of the more complecated code where a tonnes of other values are involved.
Any help is appreciated.

Moiz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multiple FORMS on same page problem.

2003-09-15 Thread Chris Shiflett
--- Golawala, Moiz M (IndSys, GE Interlogix) [EMAIL PROTECTED] wrote:
 I am creating a page with 2 buttons.
...
 form action=page4.php method=post
   ?php echo this is page 4; ?
   input type=text name='someVal' value=''
   input type='submit' value='page4 Submit'
 /form
 form action=page5.php method=post
   input type='submit' value='page5 Submit'
 /form
...
 I would like to see the variable 'someVal' in the $_POST of both
 page4 Submit button and page5 Submit button.

Then put someVal in both forms. When you submit a form, only the data in the
form will be sent to the server.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multiple Forms

2003-09-10 Thread Matthew Vos
html
body
iframe name=post1 src=about:blank height=1 width=1 frameborder=no
scrolling=no/iframe
iframe name=post2 src=about:blank height=1 width=1 frameborder=no
scrolling=no/iframe
form name=form1 action=form_parser1.php target=post1
input type=text name=form1_value1
/form
form name=form2 action=form_parser2.php target=post2
input type=text name=form2_value1
/form
a href=about:blank onClick=form1.submit();form2.submit();return
falseProcess Forms/a
/body
/html

Matt

On Tue, 2003-09-09 at 20:11, Dan Anderson wrote:
 Is it possible to tell a browser to send form a to URL a and form b to
 URL b?
 
 (i.e. post to two different URLS)
 
 Thanks,
 
 -Dan


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Multiple Forms

2003-09-09 Thread Robert Cummings
You can have two different forms posted to two different URLs. Not sure
if you can in a single submit post two different forms to two different
URLs except maybe with Javascript.

Cheers,
Rob.

On Tue, 2003-09-09 at 20:11, Dan Anderson wrote:
 Is it possible to tell a browser to send form a to URL a and form b to
 URL b?
 
 (i.e. post to two different URLS)
 
 Thanks,
 
 -Dan
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multiple forms

2002-12-30 Thread Tyler Longren
- Original Message -
From: Doug Coning [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]
Sent: Monday, December 30, 2002 3:26 PM
Subject: [PHP] Multiple forms


 Hi all,

 I have an update page that has a form in it.

 However, I want to add another form in the same page.  My current form
acts
 upon itself (i.e. Action = the same page).  If I set up another form to do
 the same, how would my PHP determine with action submit button was acted
 upon?

 Currently, for the single form here is how it knows a form was submitted:

 if ((isset($HTTP_POST_VARS[MM_update]))  ($HTTP_POST_VARS[MM_update]
 == form1)) {

 How would I test which form submitted the action?

 Thanks and if I didn't make myself clear, I apologize.

 Doug


Hi Doug,

I handle it like this (I think):

Then, to process your form:
?
if ($_POST[option] == ) {
// the form code should go here
}

else if ($_POST[option] == form1) {
print This will parse form1;
}

else if ($_POST[option] == form2) {
print This will parse form2;
}
?

I haven't done this in a while though, so this may not work for you.

Good luck,
Tyler


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Multiple forms

2002-12-30 Thread Marco Tabini
You should be able to insert a hidden field in your form and that check
against that in your PHP script to determine which (if any) of your form
was submitted:

form
input type=hidden name=f value=1
/form


form
input type=hidden name=f value=2
/form


in your script:

?php

switch ($_POST['f'])
{
case '1':

// first form

break;

case '2':

// second form

break;

default:

// no form
}

That's just one way you can do it. Hopefully it addresses your problem!

Cheers,


Marco
-- 

Marco Tabini
Publisher

php|architect
A Publication of the MTA Group, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057

---BeginMessage---
Hi all,

I have an update page that has a form in it.

However, I want to add another form in the same page.  My current form acts
upon itself (i.e. Action = the same page).  If I set up another form to do
the same, how would my PHP determine with action submit button was acted
upon?

Currently, for the single form here is how it knows a form was submitted:

if ((isset($HTTP_POST_VARS[MM_update]))  ($HTTP_POST_VARS[MM_update]
== form1)) {

How would I test which form submitted the action?

Thanks and if I didn't make myself clear, I apologize.

Doug




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



---End Message---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Multiple forms

2002-12-30 Thread John W. Holmes
 I have an update page that has a form in it.
 
 However, I want to add another form in the same page.  My current form
 acts
 upon itself (i.e. Action = the same page).  If I set up another form
to do
 the same, how would my PHP determine with action submit button was
acted
 upon?
 
 Currently, for the single form here is how it knows a form was
submitted:
 
 if ((isset($HTTP_POST_VARS[MM_update])) 
($HTTP_POST_VARS[MM_update]
 == form1)) {
 
 How would I test which form submitted the action?
 
 Thanks and if I didn't make myself clear, I apologize.

Just name each submit button something different. The program could
check for $_POST['MM_update'] to process the first form, or
$_POST['MM_update2'] to update the second.

input type=submit name=MM_update value=Submit
input type=submit name=MM_update2 value=Submit

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Multiple forms

2002-12-30 Thread Chris Wesley
On Mon, 30 Dec 2002, Doug Coning wrote:

 However, I want to add another form in the same page.  My current form acts
 upon itself (i.e. Action = the same page).  If I set up another form to do
 the same, how would my PHP determine with action submit button was acted
 upon?

Give your submit buttons names and values, then you can check the button
element's value as submitted and made available in $_POST.
i.e. -
In your HTML (notice the button /names/ are the same) :

form name=form1 action= method=POST
  input type=submit name=submitButton value=form1
/form

form name=form2 action= method=POST
  input type=submit name=submitButton value=form2
/form

And in your PHP:

if( $_POST['submitButton'] == form1 ){
// do something for form 1;
} elseif( $_POST['submitButton'] == form2 ){
// do something for form 2;
} else {
// some tardnugget is playing games with your form ;)
}

There are several variations on this ... hope this one helps.

g.luck,
~Chris



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] multiple forms on the same page

2002-11-13 Thread Marek Kilimajer
No, simply name them differently (form name=formOne ...)

John Meyer wrote:


hi,
I have multiple forms on a page that refers to itself on the action.  The
only difference is that one has one extra field.  The two have every other
name in common.  Will this be difficult to handle?


 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Multiple Forms and 1 SQL table

2002-07-03 Thread Analysis Solutions

On Wed, Jul 03, 2002 at 07:18:45PM -0600, CM wrote:

 What do you do if you have a huge form that you want broken up into several
 different forms but each time the submit button is pressed the info is saved
 to the sql table.

 Do you just create the table on the first form submit and then on each
 subsequent form you just update the table?

In that second paragraph, I suspect you mean record rather than table.
Your approach sounds fine.  Grab the Insert ID from the INSERT INTO
statement and put it into a hidden field in your subsequent forms.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Multiple Forms and 1 SQL table

2002-07-03 Thread Alberto Serra

CM wrote:
 What do you do if you have a huge form that you want broken up into several
 different forms but each time the submit button is pressed the info is saved
 to the sql table.
 
 Do you just create the table on the first form submit and then on each
 subsequent form you just update the table?

If you just do that chances are your table will be mostly made of 
uncomplete (and useless) records. It looks like a long sequence and many 
a user will leave it uncomplete.

If you want to save DB performance (by not fragmenting the table too 
much) you'll better do that on a temporary table that has the same 
format of the real table plus two more fields:
1) a session identifier (use something like a session id to recognize 
current user input).
2) a timestamp.
This temporary table usually will have no referential checks (as they 
might need full data set to make sense). Still, referential integrity 
should be checked along the way by some code.

Once you finally have all the stuff you need you just:

1) select previous data from temporary table
2) add last form input
3) insert it in the real table
4) delete from the temporary table the record having the current identifyer.

Still, the temporary table will be crowded with all the uncomplete 
sequences. If you cannot set a cleaning job on the server's chron just 
have the first form of your input sequence delete all temporary records 
that are older than delta time (where delta depends on the input process 
you are managing).

This way your real table stays compact and DB performs much better.

Alberto
Kiev


-- 


-_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Multiple Forms

2002-03-03 Thread Martin Towell

1) not unless you have them opening up a new window for each form
2) combine them into one form

Martin

-Original Message-
From: Ramesh Nagendra Pillai [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 2:27 PM
To: Php Mailing list
Subject: [PHP] Multiple Forms


Hai

I am having two forms in one php page I want to submit
it to second page. My query is 

1) Is it possible to submit 2 forms using single
submit button
2) If so, how to get both form details in the secon
page?

Thanx



__
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Multiple Forms

2002-03-03 Thread Zak Greant

On Sun, 2002-03-03 at 20:31, Martin Towell wrote:
 1) not unless you have them opening up a new window for each form
 2) combine them into one form

  Also, this topic is covered quite often on this list Check the 
  list archives for the various solutions people have used
  http://phpnet/supportphp has a link to the list archive

  --zak



-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp