[eluser]Unknown[/eluser]
Hi all,
In a former version of CI I used a form and everything worked fine. Now I tried it again, but I got problems. What I did was exactly what has been described in the form validation tutorial. If I run the form:
Code:
http://myurl/index.php/form/
Firefox and Opera come back with the main page (at
http://myurl/index.php) and url:
Code:
http://myurl/index.php?form
Below you find my code.
Controller form.php:
Code:
<?php
class Form extends CI_Controller {
function index()
{
$this->load->helper(array('form','url'));
$this->load->library('form_validation');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>
View myform.php:
Code:
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo validation_errors(); ?>
<?php echo form_open('form'); ?>
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<h5>Password</h5>
<input type="text" name="password" value="" size="50" />
<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" size="50" />
<h5>Email Address</h5>
<input type="text" name="email" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
View 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>
I use CI together with mySQL, Netbeans 7.0.1 and PHP 5.2.13 on Ubuntu.
Regards,
Carmen