form codes and elements, pls help!

briant 10 May, 2007
hi, i created a simple form to test but i'm not getting a correct information when the for is submitted. below are the form codes and elements i used:

Form HTML


<p align="left">Name
<input type="text" name="name">
</p>
<p align="left">E-mail
<input type "text" name="email">
@aptaracorp.com (to receive a copy of this

request)</p>

<p align="left">Location
<select name="location" id="location">
<option selected>--Location--</option>
<option>New York</option>
<option>Los Angeles</option>
</select>
Supervisor
<select name="supervisor" size="1">
<option value="" selected>--Supervisor--

</option>
<option

value="supervisor@email.com">Supervisor</option>
</select>
</p>
<p align="left">I am requesting</span>
<input name="TotalDays" type="text"

id="totaldays" size="4" maxlength="4">
<select name="days_hrs">
<option value="days">days</option>
<option value="hours">hours</option>
</select>
of vacation time between <input name="Start

Date" type="text" id="start_date"> (first date

off) and including <input name="End Date"

type="text" id="end_date"> (last date of

vacation)<br>
I will be returning to work on <input type="text"

id="return_date" name="Return Date"><br>
Or these non-consecutive dates (please separate

dates with commas) within the same week:</span>


<textarea name="Non Consecutive Dates"

cols="35" rows="1"

id="non_consecutive_dates"></textarea>
</p><br>
<p align="left">
<input type="radio" name="Advance Pay 01"

id="advance_pay01" value="Yes">
I would like my vacation pay in advance (request

must be submitted at least
3 weeks in advance for advance pay)<br>
<input type="radio" name="Advance Pay 02"

id="advance_pay01" value="No" checked>
Please hold my check until I return</p><br>


<p align="left">

<input name="Submit" type="submit" value="Submit my Vacation Request">
</p>


Email Template

<b>Vacation Request Form</b>
<br><br>
Name : {name} <br>
Email: {email} <br>
Location: {location} Supervisor: {supervisor}
<br>
I am requesting {totaldays} {days_hrs} of vacation time between {start_date} (first date off) and including {end_date} (last date of vacation).
<br>
I will be returning to work on {return_date}.<br>
Or these nonconsecutive dates within the same

week: {non_consecutive_dates}<br><br>
{advance_pay01}{advance_pay02}<br>


Elements Title

name=Name
email=E-mail
location=Location
supervisor=Supervisor
totaldays=TotalDays
days_hrs=Days
days_hrs=Hours
start_date=Start Date
end_date=End Date
return_date=Return Date
non_consecutive_dates=Non Consecutive Dates


and here's how the email results looks like after i submit the form:

Vacation Request Form

Name : Brian
Email: [email]brian@email.com[/email]
Location: Los Angeles Supervisor: Supervisor
<br>
I am requesting {totaldays} {days_hrs} of vacation time between {start_date} (first date off) and including {end_date} (last date of vacation).

I will be returning to work on {return_date}.
Or these nonconsecutive dates within the same

Or these nonconsecutive dates within the same week: {non_consecutive_dates}

{advance_pay01}{advance_pay02}

Submitted by 192.168.0.1


the elements name, email, and locations showed up ok when i received the email. but the others (e.g. totaldays, days_hrs, etc...) didn't. they're still on the parenthesis. what did i do wrong?

by the way, here is what's in the autogenerated tab:


<?php
global $database;
$database->setQuery( "INSERT INTO #__chronoforms_1 VALUES (
'' , '". date('Y-m-d')." - ".date("H:i:s")."' , '".$_POST['name']."' , '".$_POST['email']."' , '".$_POST['location']."' , '".$_POST['supervisor']."' , '".$_POST['days_hrs']."' , '".$_POST['Submit']."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
Max_admin 10 May, 2007
Hi,

Iam not sure what the problem is but lets try those and see :

#1- at ur HTML code, plz make all ur elements names lowercase.

#2- elements names should NOT contain any spaces, instead replace it with _

Let us know the reults

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
briant 10 May, 2007
thanks! ur suggestion worked!

i have another question under "Email" and "Supervisor". on email, they can type in their email address. when they select supervisor, i can have the "value" of the supervisor as the supervisor's email. how can this form be sent to those email addresses, "email" and "supervisor" field? can this be done? thanks again!
Max_admin 13 May, 2007
at the "emailfield" at the backend, type "email" OR "supervisor", this means that the form can be emailed to ONLY 1 of those fields values but not the 2, sorry.

however u can chronocontact.php, change this line :

if(trim($paramsvalues->emailfield) != ""«»){
					$recipient = $_POST[$paramsvalues->emailfield];
					mosMail($from, $fromname, $recipient, $subject, $body, true, NULL, NULL, NULL, NULL, NULL ); 
				}


to :



if(trim($paramsvalues->emailfield) != ""«»){
					$recipients = explode(",",$_POST[$paramsvalues->emailfield]);
foreach($recipients as $recipient){
					mosMail($from, $fromname, $recipient, $subject, $body, true, NULL, NULL, NULL, NULL, NULL ); 
}
				}


then u can add the "emailfield" : email,supervisor

Plz let me know how it will work.

Cheers
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
briant 16 May, 2007
thanks but i still don't get the email when i put "email,supervisor" under emailfield.
GreyHead 06 Jun, 2007
Hi,

After writing a long and mostly incorrect e-mail I think I've spotted a problem. Max suggested

if(trim($paramsvalues->emailfield) != ""«»){
    $recipients = explode(",",$_POST[$paramsvalues->emailfield]);
    foreach($recipients as $recipient){
        mosMail($from, $fromname, $recipient, $subject, $body, true, NULL, NULL, NULL, NULL, NULL ); 
    }
}


I think this has the $_POST in the wrong place. Try

if ( trim($paramsvalues->emailfield) != "" ) {
    $recipients = explode(",", $paramsvalues->emailfield);
    foreach ($recipients as $recipient) {
        mosMail($from, $fromname, $_POST[$recipient], $subject, $body, true, NULL, NULL, NULL, NULL, NULL ); 
    }
}


Bob
briant 07 Jun, 2007
it works! thanks bob!
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger