Hi,
I've got a form that requests information from our student and emails it to our advisors. For now this function is all I'm working on, later I'd like to instead be able to save it to a database and email a link of the saved form instead of the contents of the form. I'm interested in how I should use form data for email variables. I have seen this thread:
http://www.chronoengine.com/index.php?option=com_fireboard&Itemid=37&func=view&id=5672&catid=2
And I've seen the tutorial, but I must be missing something "obvious" somewhere. I have these fields in my Form HTML:
I'll be transforming it to a CSS-based layout later, so please just ignore the table formatting for now🙂
And then in the second tab called "Special Fields" I have subject name and email in the corresponding fields. Then in the next tab in the OnSubmit before email is sent I have the following PHP code:
Yet when I fill out the form with a name, ID and email address, I only get the name and email variables working (they show up in the From line); the subject is always blank. If I remove the OnSubmit code, the special fields "subject" and put something in the General subject box, it gets passed through appropriately.
Is it something wrong with my PHP code? Any help would be appreciated!
-Chad
I've got a form that requests information from our student and emails it to our advisors. For now this function is all I'm working on, later I'd like to instead be able to save it to a database and email a link of the saved form instead of the contents of the form. I'm interested in how I should use form data for email variables. I have seen this thread:
http://www.chronoengine.com/index.php?option=com_fireboard&Itemid=37&func=view&id=5672&catid=2
And I've seen the tutorial, but I must be missing something "obvious" somewhere. I have these fields in my Form HTML:
<td>Name:</td>
<td colspan="3"><input name='name' type='text' size="30" /></td>
</tr>
<tr>
<td>Student ID: </td>
<td colspan="3"><input name='studentID' type='text' size="20" /></td>
</tr>
<tr>
<td>Email address: </td>
<td colspan="3"><input name='email' type='text' size="40" /></td>
I'll be transforming it to a CSS-based layout later, so please just ignore the table formatting for now🙂
And then in the second tab called "Special Fields" I have subject name and email in the corresponding fields. Then in the next tab in the OnSubmit before email is sent I have the following PHP code:
<?php $_POST['subject'] = "Major Status application for" $_POST['name'] ?>
Yet when I fill out the form with a name, ID and email address, I only get the name and email variables working (they show up in the From line); the subject is always blank. If I remove the OnSubmit code, the special fields "subject" and put something in the General subject box, it gets passed through appropriately.
Is it something wrong with my PHP code? Any help would be appreciated!
-Chad
Hi Chad,
The problem is that ChronoForms doesn't know that you are creating a field called 'subject'. Add a hidden field to your form:
Bob
The problem is that ChronoForms doesn't know that you are creating a field called 'subject'. Add a hidden field to your form:
<input type="hidden' name="subject" value="" />
Then ChronoForms will create a placeholder that will be filled in by your OnSubmit code.
Bob
Thank you! You did mention that in the above referenced thread, I guess I just didn't see it or understand what it did enough to pay attention to that. Thanks again!
-Chad
-Chad
I must have some typo that I'm not seeing, but I still cannot seem to get a subject when I use variables from my form. Just to recap what I've done:
In the General section:
Subject: subject
From Email: email
From name: name
In the Special Fields section:
subject field: subject
From email field: email
From name field: name
In the HTML of my form:
And when I feel out my form and hit submit, the subject field of my email is still blank.
Any ideas?
Thanks!
-Chad
In the General section:
Subject: subject
From Email: email
From name: name
In the Special Fields section:
subject field: subject
From email field: email
From name field: name
In the HTML of my form:
<input type="hidden" name="subject" value="" />
<label for="name">Name:</label><input name='name' id='name' type='text'/>
<label for="studentID">Student ID:</label><input name='studentID' id='studentID' type='text' />
<label for="email">Email address:</label><input name='email' id='email' type='text' />
And when I feel out my form and hit submit, the subject field of my email is still blank.
Any ideas?
Thanks!
-Chad
:) Yes I do, thanks for asking.
Onsubmit before email is sent:
And I've tried with and without quotes around my text:
Thanks!
-Chad
Post edited by: MasterC, at: 2008/03/28 02:01<br><br>Post edited by: MasterC, at: 2008/03/28 02:02
Onsubmit before email is sent:
<?php $_POST['subject'] = Intermediate Status application for $_POST['name'] ?>
And I've tried with and without quotes around my text:
<?php $_POST['subject'] = "Intermediate Status application for" $_POST['name'] ?>
Thanks!
-Chad
Post edited by: MasterC, at: 2008/03/28 02:01<br><br>Post edited by: MasterC, at: 2008/03/28 02:02
Hi Chad,
It should be :
It should be :
<?php $_POST['subject'] = "Intermediate Status application for".$_POST['name'] ?>
This topic is locked and no more replies can be posted.