Welcome Guest, Not a member yet? Register   Sign In
from post goes from index.php/form to index.php?form
#1

[eluser]coderex[/eluser]
Hi,

I've just starting learning CI and from the form example in codeigniter when I post, apart from no validation messages it goes from http://mysite.com/codigniter/index.php/form to http://mysite.com/codigniter/index.php?form which displays a completely different page, not the form, why is it showing ? ,?. I think there's some sort of config issue, can anyone give me a hand please?

## controller example in code igniter

<?php

class Form extends CI_Controller {

function index()
{
$this->load->helper(array('form', 'url'));

$this->load->library('Form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');

if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>

<html>
<head>
<title>My Form</title>
</head>
<body>

## myform

<?php echo validation_errors(); ?>

<?php echo form_open('form'); ?>

<h5>Username</h5>
&lt;input type="text" name="username" value="" size="50" /&gt;

<h5>Password</h5>
&lt;input type="text" name="password" value="" size="50" /&gt;

<h5>Password Confirm</h5>
&lt;input type="text" name="passconf" value="" size="50" /&gt;

<h5>Email Address</h5>
&lt;input type="text" name="email" value="" size="50" /&gt;

<div>&lt;input type="submit" value="Submit" /&gt;&lt;/div>

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;

## form success

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My Form&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

<h3>Your form was successfully submitted!</h3>

<p>&lt;?php echo anchor('form', 'Try it again!'); ?&gt;</p>

&lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
from post goes from index.php/form to index.php?form - by El Forum - 03-09-2011, 03:10 AM
from post goes from index.php/form to index.php?form - by El Forum - 03-09-2011, 04:56 AM
from post goes from index.php/form to index.php?form - by El Forum - 03-09-2011, 07:33 AM
from post goes from index.php/form to index.php?form - by El Forum - 03-09-2011, 09:01 AM
from post goes from index.php/form to index.php?form - by El Forum - 03-09-2011, 11:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB