Ok, I'm not entirely sure I'm doing this correctly. I'm trying to create stored form templates where the variables are stored as well.
$query = "SELECT *
FROM form_variable";
$result = mysql_query($query);
while ($items = mysql_fetch_array($result))
{
$pattern = stripslashes($items["form_var_name"]);
$form_var_replace = stripslashes($items["form_var_replace"]);
$replacement = "$$form_var_replace";
$form_text = preg_replace($pattern, $replacement, $form_text);
}
So stored in form_variable are two fields the first is what to look for and the second is the variable to replace it with.
So if I had the following:
{clientname} client_name
{clientpassword} client_password
stored in the database and it does a search in the template $form_text and finds {clientname} it will replace it with the value stored in $client_name.
Make sense?
If I put a die in there, after the $replacement it echo's $client_name to the screen instead of the value stored in $client_name. Is there a way to do what I'm wanting to do?
Thanks for your help