[eluser]neoevents[/eluser]
views/applyforpartnerform.php :
Code:
<html>
<head>
<title>Apply For Partner/Affiliate</title>
</head>
<body>
<?php echo $this->validation->error_string; ?>
<?php echo form_open('form'); ?>
<h5>Site URL:</h5>
<input type="text" name="site" value="<?php echo $this->validation->site;?>" size="50" />
<h5>Applying for Partner or Affilate?</h5>
<input type="text" name="which" value="<?php echo $this->validation->which;?>" size="50" />
<h5>Button IMG URL:</h5>
<input type="text" name="img" value="<?php echo $this->validation->img;?>" size="50" />
<h5>Email Address:</h5>
<input type="text" name="email" value="<?php echo $this->validation->email;?>" size="50" />
<h5>Confirm Email Address:</h5>
<input type="text" name="emailcon" value="<?php echo $this->validation->emailcon;?>" size="50" />
<h5>Why should we pick you?</h5>
<input type="text" name="why" value="<?php echo $this->validation->why;?>" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
/views/formsuccess.php :
Code:
<html>
<head>
<title>My Form</title>
</head>
<body>
<h3>Your form was successfully submitted!</h3>
<p><?php echo anchor('form', 'Try it again!'); ?></p>
</body>
</html>
controllers/form.php :
Code:
<?php
class Form extends Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('validation');
$rules['site'] = "required";
$rules['which'] = "required";
$rules['img'] = "required";
$rules['email'] = "required|valid_email|matches[emailcon]";
$rules['emailcon'] = "required|valid_email";
$rules['why'] = "required";
$fields['site'] = 'What is the address of your site?';
$fields['which'] = 'Are you applying to become a partner or affilate?';
$fields['img'] = 'Enter your affiliate or partner button here.';
$fields['email'] = 'Put your email address here.';
$fields['emailcon'] = 'Confirm email address here.';
$fields['why'] = 'Explain why we should here.';
$this->validation->set_fields($fields);
$this->validation->set_rules($rules);
if ($this->validation->run() == FALSE)
{
$this->load->view('applyforpartnerform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>