Hi-- this might be asking a lot, but I've built a form for newsletter subscriptions that pulls valid newsletters via PHP query from the Yanc table, and displays the name of the newsletter, the description and a checkbox at the bottom of the chronoform.
How can I have these dynamically generated items included in the results emailed after the form submission? How can I write a post-PHP routine to insert the subscriptions into the Yanc table?
If there's an FAQ or post describing this type of form I'd appreciate a link.
thanks!
How can I have these dynamically generated items included in the results emailed after the form submission? How can I write a post-PHP routine to insert the subscriptions into the Yanc table?
If there's an FAQ or post describing this type of form I'd appreciate a link.
thanks!
Hi pbass98,
If you have them showing in the form then you can add hidden form fields to add them to the form data. That looks like
Bob
If you have them showing in the form then you can add hidden form fields to add them to the form data. That looks like
<input type='hidden' value='<?php echo $variable; ?>' />
In the back end you just need to add the SQL to add them to the Yanc table - you can put this in the AutoGenerated Code tab and use the ChronoForms code as a model. Just what SQL you use will depend if you are adding or updating the Yanc records.
Bob
Thanks Bob-- here's the code that's currently printing the form checkboxes--
Are you saying to add hidden fields too? Or do I add the hidden fields somewhere else?
Also, I hope I explain this ok, but how do I reference a variable that gets generated dynamically? I don't quite understand that part at all.
thanks for your help.
EDIT: Fireboard doesn't do a great a job with code, so if you view the post source you should see what I'm talking about.
<?php
if( count($total) > 0 )
{
foreach( $rows as $r ){
echo '
<tr>
<td></td>
<td><input type="checkbox" name="newsletter_' . $r->id. '" value="' . $r->id.'"> ' . $r->name . '</td>
</tr> ';
}
}
?>
Are you saying to add hidden fields too? Or do I add the hidden fields somewhere else?
Also, I hope I explain this ok, but how do I reference a variable that gets generated dynamically? I don't quite understand that part at all.
thanks for your help.
EDIT: Fireboard doesn't do a great a job with code, so if you view the post source you should see what I'm talking about.
Hi pbass98,
OK I misunderstood a bit, I thought you were displaying the dynamic info rather than using it in field values. In the post array you should have a string of $_POST['newsletter_xxx']='value' results, you can use these in the results email.
Personally I'd probably use an array for the newsletter[$r->id] names as that makes the results easier to handle. If you want to keep the dynamic names then use a hidden field with value=$r->name - again a good choice of array structure for the name will make this easier to handle.
Bob
OK I misunderstood a bit, I thought you were displaying the dynamic info rather than using it in field values. In the post array you should have a string of $_POST['newsletter_xxx']='value' results, you can use these in the results email.
Personally I'd probably use an array for the newsletter[$r->id] names as that makes the results easier to handle. If you want to keep the dynamic names then use a hidden field with value=$r->name - again a good choice of array structure for the name will make this easier to handle.
Bob
Or you may need to hack chronocontact.php
find first occurance of $htmlstring = $rows[0]->html; inside the uploadandmail function and replace it with :
Cheers
Max
find first occurance of $htmlstring = $rows[0]->html; inside the uploadandmail function and replace it with :
ob_start();
eval("?>".$rows[0]->html);
$htmlstring = ob_get_clean();
Cheers
Max
This topic is locked and no more replies can be posted.