I have a website that was done in Modx(yuck) and using FormIt I created a simple page with 1 field, an email textbox.
<form method="post" action="" id="1">
<label for="advisorName">Email Address:</label><input id="email" type="text" name="email" value=""></form>
How can I get the email field populated from an url like:
www.example.com/unsubscribe.html?id=1&[email protected]
This is easy for me with a standard website, but I am so lost with Modx.
You want to create a "Snippet", which is just a piece of php code. Call your snippet whatever and something like this should do:
return (!empty($_GET['email']) ? $_GET['email'] : 'Enter e-mail');
Then in your chunk/template or wherever that code you pasted is, change the input value to: value="[[!NameOfYourSnippet]]"
. The bracers indicate that it's a snippet you want to call and the exclamation mark tells modx not to cache whatever is rendered by it.
Happy modx:ing!