Welcome Guest, Not a member yet? Register   Sign In
validating forms
#1

[eluser]wilfred[/eluser]
I have loaded the following controller but am unable to submit to the database...Please help.
<?php
class Blog2 extends Controller{

function Index()
{
$subjects = array('I want to dance'=>'I want to dance', 'I have a real question'=>'I have a real question');

$this->form
->sel('subject',$subjects)
->add('name')
->add('phone')
->add('email')
->ta('notes')
->sub('submit');

$to = "[email protected]";
$subject = "{subject}";
$message = "Name: {name}\n"
. "Phone: {phone}\n"
. "Email: {email}\n"
. "Notes: {notes}";
$values = array($to,$subject,$message);

$this->form
->onSuccess('send_email',$values,array('{phone}'=>'phone'))
->onSuccess('redirect', 'thispath/success');

$data = array('form'=>$this->form->get());
$this->load->view('my_view_file', $data);
}
}
?>
#2

[eluser]djenniex[/eluser]
1. You've posted in the wrong forum.
2. What you have posted, from my perspective isn't even CodeIgniter code (there is no such function as onSuccess anywhere in the documentation, plus it doesn't conform with the style guide).
3. You don't submit to a database, you insert or update.
4. You haven't given us any code examples of how you trying to insert/update into your database
5. Are you using a custom library? If so, you might want to state it in your detailed explanation of your problem.
6. I can continue this all day




Theme © iAndrew 2016 - Forum software by © MyBB