代码点火器
你好。我想将表单数据发送到数据库。数据检查正常,但下一步该怎么做?
我的控件
<?php
class Form extends CI_Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('name', 'Imie', 'required|min_length[5]|max_length[25]|required|alpha');
$this->form_validation->set_rules('surname', 'Nazwisko', 'required|min_length[5]|max_length[25]|required|alpha');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('number', 'Numer telefonu', 'required|alpha_numeric|max_length[10]');
$this->form_validation->set_rules('brand', 'Marka', 'required|alpha');
$this->form_validation->set_rules('model', 'Model', 'required|alpha');
$this->form_validation->set_rules('year', 'Rok produkcji', 'required|alpha_numeric|max_length[5]');
$this->form_validation->set_rules('km', 'Ilosc KM', 'required|alpha_numeric|max_length[5]');
$this->form_validation->set_rules('licenceseplate', 'Tablica rejestracyjna', 'required|max_length[15]');
$this->form_validation->set_rules('description', 'Opis', 'required|max_length[300]');
$this->form_validation->set_rules('city', 'Miasto', 'required|max_length[30]');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>
我的观点
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo form_open('form'); ?>
<h5>Wpisz swoje imię</h5>
<?php echo form_error('name'); ?>
<input type="text" name="name" value="<?php echo set_value('name'); ?>" size="50" />
<h5>Nazwisko</h5>
<?php echo form_error('surname'); ?>
<input type="text" name="surname" value="<?php echo set_value('surname'); ?>" size="50" />
<h5>Email Address</h5>
<?php echo form_error('email'); ?>
<input type="text" name="email" value="<?php echo set_value('email'); ?>" size="50" />
<h5>Numer telefonu</h5>
<?php echo form_error('number'); ?>
<input type="text" name="number" value="<?php echo set_value('number'); ?>" size="50" />
<h5>Marka</h5>
<?php echo form_error('brand'); ?>
<input type="text" name="brand" value="<?php echo set_value('brand'); ?>" size="50" />
<h5>Model</h5>
<?php echo form_error('model'); ?>
<input type="text" name="model" value="<?php echo set_value('model'); ?>" size="50" />
<h5>Rok produkcji</h5>
<?php echo form_error('year'); ?>
<input type="text" name="year" value="<?php echo set_value('year'); ?>" size="50" />
<h5>km</h5>
<?php echo form_error('km'); ?>
<input type="text" name="km" value="<?php echo set_value('km'); ?>" size="50" />
<h5>Rejestracja </h5>
<?php echo form_error('licenceseplate'); ?>
<input type="text" name="licenceseplate" value="<?php echo set_value('licenceseplate'); ?>" size="50" />
<h5>Opis </h5>
<?php echo form_error('description'); ?>
<input type="text" name="description" value="<?php echo set_value('description'); ?>" size="50" />
<h5>Miasto </h5>
<?php echo form_error('city'); ?>
<input type="text" name="city" value="<?php echo set_value('city'); ?>" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
我不指望最终的解决方案,但我需要帮助下一步是什么
我的数据库: