[eluser]scm22ri[/eluser]
Hi Everyone,
I'm attempting to figure out a way to make dynamic URLS for my CI project.
I'm getting my data from a mysql database and I'm displaying that data on my website. My goal is to make those list items link-able.
For my test project I'm pulling all 50 states. When a user clicks on each individual state I want them to be brought to another page echoing out that state. I haven't figured out how to do this yet. How would I do it?
model_get.php
Code:
<?php
class Model_get extends CI_Model{
Below is my syntax
function stateData(){
$this->db->distinct();
$this->db->select('state');
$this->db->order_by('state','ASC');
$query = $this->db->get('dealers');
return $query->result();
}
?>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
My main controller site.php
Code:
public function dealers(){
$this->load->model("model_get");
$data["results"] = $this->model_get->stateData();
$this->load->view("site_header");
$this->load->view("site_nav");
$this->load->view("content_dealers", $data);
$this->load->view("site_footer");
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
My content_dealers.php
Code:
<div id="content">
<?php
echo '<h1><b>Search By State</b></h1>';
foreach ($results as $row){
$state = $row->state;
echo $state.'<br>';
}
?>
</div>