I don’t actually understand whether this is a tip or a question. I suspect that the "thanks" makes it a question, so I’ve moved it out of Documentation, Tips & Tricks.
I think it’s a question and now in
wrong right forum (EDIT: I read wrong at first).. I’ll try to answer:
Make the form code something like this:
<form method="post" ...>
<input type="text"...>
<select name="selectId">
<option value="0">id will be 0</option>
<option value="2">id will be 2</option>
<option value="3">id will be 3</option>
...
</select>
<input type="submit" name="submit"...>
</form>
And in snippet code:
if (isset($_POST["submit"])) {
$id = $_POST["selectId"];
$modx->sendRedirect($modx->makeUrl($id));
}
Also, take a look here:
http://modxcms.com/forums/index.php/topic,5971.msg42312.html#msg42312
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
thanx a lot, I’m not a php-master, but I have understood principle, it’s all that I wanted
-
MODX Staff
- 12,272 Posts
And be careful about using "id" as a variable name due to namespace collisions with internal MODx variables. (Ugh, I know...)
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me