I have been trying to figure out how to get the selected option to properly
show up in a select list all day with no success. It either shows up on none of
the option tags or on all of them. I've posted the relevant code below. What am
I doing wrong? Let me know if you need more information. Thanks.
PHP
-----
$id = $_REQUEST["id"]; // get the id in the url query
$formSQL = "SELECT i.id, categoryid, category, title, publication,
DATE_FORMAT(date, '%Y/%m/%d') AS fDate, author, summary, filename FROM
`resources-items` AS i LEFT JOIN `resources-categories` AS c ON
i.categoryid=c.id WHERE i.id=$id"; // get the row to be edited
$t = new PHPTAL("test.html");
$t->categories = getRows("SELECT id, category FROM `resources-categories` ORDER
BY category"); // get all categories
$t->form = getRows($formSQL);
Template
-------------
<tal:block tal:repeat="f form">
<input type="hidden" name="id" tal:attributes="value f/id" />
<label for="categoryid" class="resources">Category:</label>
<select name="categoryid" validate="required: true">
<option value="0">-- Select one --</option>
<option tal:repeat="c categories" tal:attributes="value c/id;selected php:
f.categoryid == c.id" tal:content="c/category"></option>
</select>
</tal:block>
Matt
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal