[eluser]mcrobertstd[/eluser]
Here's the view:
Code:
<form action='/add-new-property/save_listing_address' method='POST'>
<div class='TDFormHeader'>Enter Property Address</div>
<table width='100%' cellPadding='3' cellSpacing='2' class='TDForm'>
<tr>
<td valign='top' width='150'><span class='FormTitle'>Address:</span></td>
<td><input type='text' name='address' value="<?php echo set_value('address');?>"><div class='ErrorDiv'><?php echo form_error('address'); ?></div></td>
</tr>
<tr>
<td valign='top' width='150'><span class='FormTitle'>Space Number:</span></td>
<td><input type='text' name='space' value="<?=set_value('space');?>"><div class='ErrorDiv'><?php echo form_error('space'); ?></div></td>
</tr>
<tr>
<td valign='top' width='150'><span class='FormTitle'>City:</span></td>
<td><input type='text' name='city' value="<?=set_value('city');?>"><div class='ErrorDiv'><?php echo form_error('city'); ?></div></td>
</tr>
<tr>
<td valign='top' width='150'><span class='FormTitle'>State:</span></td>
<td><?=$this->system_vars->state_array_select_box(set_value('state'));?><div class='ErrorDiv'><div class='ErrorDiv'><?php echo form_error('state'); ?></div></td>
</tr>
<tr>
<td valign='top' width='150'> </td>
<td><input type='submit' name='sub' value="Continue"></td>
</tr>
</table>
</form>
part of the controller action:
Code:
function save_listing_address(){
$this->load->library('form_validation');
$this->form_validation->set_rules('address', 'Address', 'trim|required|xss_clean');
$this->form_validation->set_rules('space', 'Space', 'trim|xss_clean');
$this->form_validation->set_rules('city', 'City', 'trim|required|xss_clean');
$this->form_validation->set_rules('state', 'State', 'trim|required|xss_clean|exact_length[2]');
if ($this->form_validation->run()){
$AddressPlotter = $this->system_vars->address_plotter(set_value('address'),set_value('city'),set_value('state'));
if(isset($AddressPlotter)){
if(isset($AddressPlotter['warning'])){
$GenerateError = "<b>ADDRESS ERROR !!!</b><br>The address you have entered seems to be invalid.";
if(isset($AddressPlotter['Address']) && isset($AddressPlotter['City']) && isset($AddressPlotter['State'])) $GenerateError .= "<br><u>The closes match is:</u> ".$AddressPlotter['Address'].", ".$AddressPlotter['City'].", ".$AddressPlotter['State']." ".$AddressPlotter['Zip'];
$this->session->set_flashdata('response',$GenerateError);
redirect('/add_new_property');
}else{
$NPArray['address'] = $AddressPlotter['Address'];
$NPArray['space'] = set_value('space');
$NPArray['city'] = $AddressPlotter['City'];
$NPArray['state'] = $AddressPlotter['State'];
$NPArray['zip'] = $AddressPlotter['Zip'];
$NPArray['lon'] = $AddressPlotter['Longitude'];
$NPArray['lat'] = $AddressPlotter['Latitude'];
$this->session->set_userdata('np_address', $NPArray);
redirect('/add_new_property/community_select');
}
}else{
$this->form_validation->set_message('check_address', "<b>ADDRESS ERROR !!!</b><br>The address you have entered does NOT exist.<br>");
return false;
}
}else{
$this->load->view('elements/header_view');
$this->load->view('add_new_property/listing_address');
$this->load->view('elements/footer_view');
}
}
Here's the code snippet in the Form_Validation showing why I was interested in the $_POST array
Code:
/**
* Run the Validator
*
* This function does all the work.
*
* @access public
* @return bool
*/
function run($group = '')
{
// Do we even have any data to process? Mm?
if (count($_POST) == 0)
{
return FALSE;
}
The validater is always returning false and when I examine the $_POST array here, it is empty. The form redisplays itself because it thinks nothing has been submitted.
Thanks,
mcrobertstd