Bind form input field to CodeIgniter query
I am trying to do query binding using CodeIgniter, and for the value in my
array I want to reference a form input element. What is the correct syntax
to do this?
Here is the current query binding:
$sql = "SELECT * FROM myTable WHERE Municipality = ?";
$myQuery = $this->db->query($sql, array('Windsor'));
Rather than have this query filtered on the value 'Windsor', I want to
refer to the value of myCity in the form called myForm. Here is the form:
<form name="myForm">
<fieldset>
<label>Average Sale Prices per SF
<input type="text"
id="myCity" />
</label>
</fieldset>
</form>
So, how do I substitute the array value 'Windsor' for the form input field
'myCity'?
No comments:
Post a Comment