View Full Version : Errors in sending forms
balexander389215
11-17-2009, 08:48 AM
After 3 days of creating and recreating a form and trying to send it through UE I finally got it to work. I used the php script offered in the tutorial to dump the contents of the form into the email. Again success except for one part. The form is an Appointment Request. There is a list of times that one selects. The email has the work, array, in place of the selected time. Is there any fix for this?
Thanks
Jason Byrnes
11-17-2009, 01:47 PM
Change the code for outputting the contents of the form:
<?php foreach( $_POST as $pkey => $pval ) { ?>
<?php echo(str_replace("_"," ",$pkey).": ".($pval)); ?>
<?php } ?>
to:
<?php foreach( $_POST as $pkey => $pval ) { ?>
<?php if(is_array($pval)) { ?>
<?php echo(str_replace("_"," ",$pkey).": ".(implode(", ",$pval))); ?>
<?php } else { ?>
<?php echo(str_replace("_"," ",$pkey).": ".($pval)); ?>
<?php } ?>
<?php } ?>
balexander389215
11-17-2009, 06:03 PM
Thank you, now where do I enter this script. Do I have to go through the whole UE setup again or can I just replace the old script with the new. I am not really a coder but I can cut and replace with the best of them. The thing is I cannot find the location of the PHP code that I need to replace. If you can tell me which file it is in I can take it from there.
Thanks
Jason Byrnes
11-18-2009, 09:21 AM
Go to Window -> Server Behaviors to bring up the list of Server Behaviors that have been added to the page.
In the list, double click the Universal Email server behavior to edit it.
On the body Tab, replace the code you had entered originally with the modified code in my previous response.
balexander389215
11-18-2009, 09:39 AM
Thank you Jason, that did the job and I'm learning something as I go. I have one minor thing with this, I have two arrays, Best Day and Second choice and a time array with each. The email comes showing Best Day and Second Choice Day then the two times under that. Is is possible to switch the order so I get Best Day then the time from that array followed by second choice of day and the time selector for that. This just cleans it up and makes it easier to read but I can live with it as it is if there is no easy fix.
Also I was wondering if the two lines on the end can be deleted:
AppointmentRequest submit x: 99
AppointmentRequest submit y: 18
Once again they are only a minor annoyance but if you have a way to get rid of them I would like to know it.
Thanks for your help.
Brian
Jason Byrnes
11-18-2009, 11:55 AM
sure, change that code to:
<?php foreach( $_POST as $pkey => $pval ) { ?>
<?php if ($pval != "" && strpos($pkey,"AppointmentRequest") !== 0 && $pkey != "x" && $pkey != "y") { ?>
<?php if(is_array($pval)) { ?>
<?php echo(str_replace("_"," ",$pkey).": ".(implode(", ",$pval))); ?>
<?php } else { ?>
<?php echo(str_replace("_"," ",$pkey).": ".($pval)); ?>
<?php } ?>
<?php } ?>
<?php } ?>
balexander389215
11-18-2009, 12:17 PM
That got rid of the:
AppointmentRequest submit x: 99
AppointmentRequest submit y: 18
Which is great, thank you very much. It did not change the order of the information presented, I don't know if you were trying to do that or if it is even possible. If not I can live with it the way it is.
Thanks for your help.
Jason Byrnes
11-18-2009, 12:54 PM
Sorry, it is not possible to change the order they are displayed in.
balexander389215
11-18-2009, 01:48 PM
No problem, thanks for your assistance.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.