|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello:
I'm trying to valide fields in a form which has many pages and each page is its own script. When I test my form by leaving the field blank, I should receive an error message stating Please enter your name. When I click Submit, I do not receive that message after leaving the field blank. I'm not sure if it's because I'm posting to another script. I can't understand why that should matter. I included the code for the first and second page of the form. For easier reading, I am only showing one form field. In the second page of the form, I didn't include any of the form fields since page 2 shouldn't appear until all the fields on page 1 are filled in. I hope someone can help me out. Thank you in advance. This is the first page of the form. Code:
<?php
include('header_app.html');
if (isset($_POST['submitted'])) {
$errors = array();
//validate form data
if (empty($_POST['complete'])) {
$errors[] = 'Please enter your name.';
} else {
$_SESSION['complete'] = escape_data($_POST['complete']);
}
}
?>
<form action="app_admission_pg2.php" method="post">
<table class="apptable">
<tr><td class="a"><b>Application Completed by:</b></td><td class="b"><input type="text" name="complete" size="25" value="<?php if (isset($_SESSION['complete'])) echo $_SESSION['complete']; ?>"></td></tr>
</table>
<input type="submit" name="btnSubmit" id="btnSubmit" value="Page 2 >>" class="btn" >
<input type="hidden" name="submitted" value="TRUE" />
</form>
This is the second page of the form. Code:
<?php
include('header_app.html');
$_SESSION['complete']=$_POST['complete'];
<form action="app_admission_pg3.php" method="post" >
<This section will have the next batch of questions.>
</form>
|
|
#2
|
|||
|
|||
|
Sorry, I am confusing. Is this what you mean?
app_admission_pg2.php -> the second page of the form or this? app_admission_pg2.php -> the first page of the form IF app_admission_pg2.php -> the first page of the form then, try to check did you put session_start() in the beginning of the files. ----------------------------------------------- http://anaknegri.com http://pajaknenkin.com http://arifkurniawan.net http://ppi-kansai.net http://kti2007.ppi-kansai.net Last edited by kurniawan; 05-12-2007 at 12:01 PM. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|