Hi,
Sorry to disturb again… I have been trying for 2 days now, but somehow, i think the values are not carried forward from one page to the other… because the print_r($_POST) only outputs:
Connected to MySQL
Array ( [page] => 2 )
Values were not printed, and database was not updated…
Should it not be showing the entire dump including the vars used?
I’m not sure, but I guess something was left out in the index or submit file… Here’s the code for both, please let me know where it went wrong.
Index.php
[code]<?php
require(‘functions.php’);
$page = isset($_POST[‘page’]) ? $_POST[‘page’] : 0;
if (isset($GET[‘page’])) $page = $GET[‘page’];
$data = validator_get_data('rules’ . $page . ‘.txt’);
$page++;
$nextpage = file_exists('rules’ . $page . ‘.txt’);
?>
Dynamic Validation
Registration Form: Page <?php echo $page; ?>
<?php
foreach ($_POST as $key => $value) {
if ($key == 'page') continue;
echo ' ' . "n";
}
?>
<?php echo validator_build_form($data, $page - 1); ?>
The form is not filled correctly. Please fix all errors before proceeding.
The form is filled correctly. Please submit the form and proceed to part <?php echo $page; ?>.
Valid XHTML 1.0 Strict,
Valid CSS!
[/code]
Submit.php
[code]<?php
$username = “test”;
$password = “test”;
$hostname = “localhost”;
$dbh = mysql_connect($hostname, $username, $password)
or die(“Unable to connect to MySQL”);
print “Connected to MySQL
”;
$selected = mysql_select_db(“reg”,$dbh)
or die(“Could not select reg”);
mysql_close($dbh);
$table = “sturegtest”;
$fields=array(‘name’,‘nameFirst’,‘nameLast’,‘nameChurch’,‘addressChurch’,‘regularlyAttend’,‘memberChurch’);
$sql=‘INSERT INTO sturegtest
SET ‘;
$sqlvalues=array();
foreach ($_POST as $key => $value)
{
if(in_array($key,$fields))
$sqlvalues = ‘'.$key.'
="’.mysql_real_escape_string($value).’"’;
}
$sql.=implode(’, ',$sqlvalues);
print_r($_POST);
?> [/code]