ok, here is the code. I am so sory it is the very long one. This needs to be sticky multipage form, thing is that the whole form is done in one file and i am using code like
<?php
EOD;
if ($step == 2) $form = <<< EOD
?>
to separate the pages.
part of the form:
<?php
// script author: pieter !AT! duijves ~DOT (no spam)~ nl
// date creation: 27-06-2007
// date last modification: 11-07-2007
// info on the used form validator: http://www.softcomplex.com/products/tigra_form_validator/docs/
// useful editor for maintenance with php/html syntax highlighting: http://www.crimsoneditor.com/
// configuration
$conf_forms = 3; // number of forms
$conf_from = 'example@example.com';
$conf_to = 'example@example.com, example2@example.com';
$conf_subject = 'Property Data Sheet of '; // script will add the owners email to the subject line
$conf_field_email = 'owner-email'; // the name of the form field containing the email address that will be used for sending a copy
// script name
$script_name = $_SERVER['PHP_SELF'];
// session stuff
session_start();
//@header('Cache-control: private'); // probably not needed...
if($_SESSION['form_data']) $form_data_tmp = unserialize($_SESSION['form_data']);
$step = $_REQUEST['step']; // POST better
if (!$step) {
$step = 1; // default
$form_data_tmp = array();
}
$step_next = $step + 1;
foreach ((array)$_POST as $key=>$val)
{
if ($key != 'step' && $key != 'submit') {
$form_data_tmp[$key] = $val;
}
}
if(!session_is_registered('form_data')) session_register('form_data'); // init session
$_SESSION['form_data'] = serialize($form_data_tmp);
$email_cc = $form_data_tmp[$conf_field_email]; // get the email address used for sending a copy
$email_cc = preg_replace('/[^\w\_\-\.\@]/', '', $email_cc); // untaint email number
if ($step > $conf_forms) { // email the form data at the last step
$message = "form data:\n\n";
$maxlen = 0;
foreach ((array)$form_data_tmp as $key=>$val) {
if ($maxlen < strlen($key)) $maxlen = strlen($key);
}
foreach ((array)$form_data_tmp as $key=>$val) {
$line = sprintf("%-$maxlen.s: ", $key);
$line .= trim($val); // trim whitespace from data value
$line = wordwrap($line, 66, "\n", true);
$line = preg_replace('/\n/', "\n ", $line); // indent multi-line data values
$line .= (preg_match('/\n/', $line)) ? "\n\n" : "\n"; // extra newline under multi-line data values
$message .= $line;
}
//$message = wordwrap($message, 70, "\n", true);
$headers = '';
$headers .= 'From: ' . $conf_from . "\r\n";
$headers .= 'Cc: ' . $email_cc . "\r\n";
mail($conf_to, $conf_subject.$email_cc, $message, $headers);
}
if ($step == 1) $form = <<< EOD
?>
<form action="$script_name" method="post" name="webform" id="webform">
<input type="hidden" name="step" value="$step_next">
<table class="formtable">
<tr>
<td class="col1"> </td>
<td class="col2"> </td>
<td class="col3"> </td>
<td class="col4"> </td>
</tr>
<tr>
<td colspan="4" class="group-title">Property details</td>
</tr>
<tr>
<td id="t-property-address">Address:</td>
<td><input type="text" name="property_address" class="wide" value="<?php if(isset($_POST['property_address'])) echo $_POST['property_address'];?>"></td>
<td id="t-property-floor-nr">Floor No.: <input type="text" name="property-floor-nr" size="3" value="<?php if(isset($_POST['property-floor-nr'])) echo $_POST['property-floor-nr']; ?>"></td>
<td id="t-property-door-nr">Door No.: <input type="text" name="property-door-nr" size="3" value="<?php if(isset($_POST['property-door-nr'])) echo $_POST['property-door-nr']; ?>"></td>
</tr>
<tr>
<td id="t-property-postal-code">Postal code:</td>
<td><input type="text" name="property-postal-code" class="halfwide" value="<?php if(isset($_POST['property-postal-code'])) echo $_POST['property-postal-code']; ?>"></td>
<td id="t-property-city">City:</td>
<td><select name="property-city" class="wide"><option value="" <?php if (!(strcmp("", $_POST['property-city'])))) {echo "selected=\"selected\"";} ?>> </option><option value="Barcelona" <?php if (!(strcmp("Barcelona", $_POST['property-city'])))) {echo "selected=\"selected\"";} ?>>Barcelona</option><option value="Lisbon" <?php if (!(strcmp("Lisbon", $_POST['property-city'])))) {echo "selected=\"selected\"";} ?>>Lisbon</option><option value="Madrid" <?php if (!(strcmp("Madrid", $_POST['property-city'])))) {echo "selected=\"selected\"";} ?>>Madrid</option><option value="Paris" <?php if (!(strcmp("Paris", $_POST['property-city'])))) {echo "selected=\"selected\"";} ?>>Paris</option>
</select></td>
</tr>
<tr>
<td id="t-property-neighbourhood">Neighbourhood:</td>
<td><input type="text" name="property-neighbourhood" class="wide" value="<?php if(isset($_POST['property-neighbourhood'])) echo $_POST['property-neighbourhood']; ?>"></td>
<td id="t-property-metro-bus">Metro/tram/bus station:</td>
<td><input type="text" name="property-metro-bus" class="wide" value="<?php if(isset($_POST['property-metro-bus'])) echo $_POST['property-metro-bus']; ?>"></td>
</tr>
<tr>
<td id="t-property-size">Size:</td>
<td><input type="text" name="property-size" size="3" value="<?php if(isset($_POST['property-size'])) echo $_POST['property-size']; ?>"> sqm</td>
<td id="t-property-lift">Lift:</td>
<td><input <?php if (!(strcmp($_POST['property-lift']),"yes"))) {echo "checked=\"checked\"";} ?> type="radio" class="radio" name="property-lift" value="yes">
yes <input <?php if (!(strcmp($_POST['property-lift']),"no"))) {echo "checked=\"checked\"";} ?> type="radio" class="radio" name="property-lift" value="no">
no</td>
</tr>
<tr>
<td class="spacer"> </td>
</tr>
<tr>
<td colspan="4" class="group-title">Owner details</td>
</tr>
<tr>
<td id="t-owner-first-name">First name:</td>
<td><input type="text" name="owner-first-name" class="wide" id="o_first_name" value="<?php if(isset($_POST['owner-first-name'])) echo $_POST['owner-first-name']; ?>"></td>
<td id="t-owner-surname">Surname:</td>
<td><input type="text" name="owner-surname" class="wide" id="o_surname" value="<?php if(isset($_POST['owner-surname'])) echo $_POST['owner-surname']; ?>"></td>
</tr>
<tr>
<td id="t-owner-address">Address:</td>
<td><input type="text" name="owner-address" class="wide" value="<?php if(isset($_POST['owner-address'])) echo $_POST['owner-address']; ?>"></td>
<td id="t-owner-postal-code">Postal code:</td>
<td><input type="text" name="owner-postal-code" class="halfwide" value="<?php if(isset($_POST['owner-postal-code'])) echo $_POST['owner-postal-code']; ?>"></td>
</tr>
<tr>
<td id="t-owner-city">City:</td>
<td><input type="text" name="owner-city" class="wide" value="<?php if(isset($_POST['owner-city'])) echo $_POST['owner-city']; ?>"></td>
<td id="t-owner-country">Country:</td>
<td><input type="text" name="owner-country" class="wide" value="<?php if(isset($_POST['owner-country'])) echo $_POST['owner-country']; ?>"></td>
</tr>
<tr>
<td id="t-owner-phone">Phone:</td>
<td><input type="text" name="owner-phone" class="wide" id="o_phone" value="<?php if(isset($_POST['owner-phone'])) echo $_POST['owner-phone']; ?>"></td>
<td id="t-owner-mobile-phone">Mobile phone:</td>
<td><input type="text" name="owner-mobile-phone" class="wide" id="o_mobile_phone" value="<?php if(isset($_POST['owner-mobile-phone'])) echo $_POST['owner-mobile-phone']; ?>"></td>
</tr>
<tr>
<td id="t-owner-email">Email address:</td>
<td><input type="text" name="owner-email" class="wide" id="o_email" value="<?php if(isset($_POST['owner-email'])) echo $_POST['owner-email']; ?>"></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="spacer"> </td>
</tr>
<tr>
<td colspan="4" class="group-title">Accommodation management details</td>
</tr>
<tr>
<td colspan="4"><input type="checkbox" name="contact-same-as-owner" value="yes" class="checkbox" onClick="if(this.checked){var f=document.webform;f.c_name.value=f.o_first_name.value+' '+f.o_surname.value;f.c_email.value=f.o_email.value;f.c_alt_phone.value=f.o_phone.value;f.c_mobile_phone.value=f.o_mobile_phone.value;}" <?php if (!(strcmp($_POST['contact-same-as-owner']),"yes"))) {echo "checked=\"checked\"";} ?>> click here if all contact details are the same as owner</td>
</tr>
<tr>
<td id="t-contact-name">Arrival contact name:</td>
<td><input type="text" name="contact-name" class="wide" id="c_name" value="<?php if(isset($_POST['contact-name'])) echo $_POST['contact-name']; ?>"></td>
<td id="t-contact-email">Email address:</td>
<td><input type="text" name="contact-email" class="wide" id="c_email" value="<?php if(isset($_POST['contact-email'])) echo $_POST['contact-email']; ?>"></td>
</tr>
<tr>
<td id="t-contact-mobile-phone">Mobile phone:</td>
<td><input type="text" name="contact-mobile-phone" class="wide" id="c_mobile_phone" value="<?php if(isset($_POST['contact-mobile-phone'])) echo $_POST['contact-mobile-phone']; ?>"></td>
<td id="t-contact-alternative-phone">Alternative phone:</td>
<td><input type="text" name="contact-alternative-phone" class="wide" id="c_alt_phone" value="<?php if(isset($_POST['contact-alternative-phone'])) echo $_POST['contact-alternative-phone']; ?>"></td>
</tr>
<tr>
<td class="spacer"> </td>
</tr>
<tr>
and this is using tigra form validator script.
if you have time i can attach the whole thing.
thank you sooo much for your help. 🙂