Reply to Form handling

Your name:

Reply:


Posted by Dan on 05/12/05 02:57

Hello, all -

I've been researching how to handle forms properly, and I think I
figured out a way that might be beneficial for me to use. It is as follows:

(index.php)

session_start();
if (isset($_SESSION['step'])) {
switch $_SESSION['step'] {
case "1":
require('step1.php');
break;
case "2":
require('step2.php');
break;
case "3":
require('step3.php');
break;
// add more case statements here if I need to
default:
require('step1.php');
break;
}
} else {
$_SESSION['step'] = '1';
require('step1.php');
}

Each stepX.php file would look something similar to this:

(step1.php)

// if submitted, check data for completeness
// if complete, set 'step' to 2, to be used as argument to index.php
$_SESSION['step'] = '2'
// redirect back to index.php, use new value of 'step' to direct
header('Location: http://somesite.com/index.php');
// else display form data




Now, this is, really, one of my first experiences with doing forms. I
just want to know if I can/should/would anticipate any problems down the
road while doing this. I think it would work quite well, but I've only
been doing this for a short while.

Thanks!
-dant

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация