I'm creating a form to announce a vote in a club that I run. The issue I'm having is that I want to put the vote identification into the subject line of the e-mail that is sent after the form is completed. But the vote ID is 2 fields, plus typed-in text. (For example, a vote id in total looks like: CC2381-01. The "CC" part is always the same, while the 2381 changes each year, and the -01 changes with each vote.)
I'm just not sure how you put three fields (year ID, vote number, and then the "subject" of the vote) into the subject of an e-mail together.
Here's the page you fill out the form on:
<?php include "../../inc/title.php"; ?>
Introducing a New CC Vote
<?php include "../../inc/header.php"; ?>
<div class=content>
<p align="left"><h1>Introducing a New Vote</h1></p>
<p>The Magistrate may use this form to introduce a new vote on the Council, in an organized and efficient manner.</p>
<FORM action=ccvote-process.php method=post>
<INPUT type=hidden value=e-mail@yahoogroups.com name=recipient>
<INPUT type=hidden value=e-mail@e-mail.org name=email>
<p><h2>Step 1: Assign the Vote an ID</h2></p>
<p align="center">This vote's identification number: CC<select name=id_year tabindex="1">
<option>2381</option>
<option>2382</option>
<option>2383</option>
<option>2384</option>
<option>2385</option>
<option>2386</option>
<option>2387</option>
<option>2388</option>
<option>2389</option></select> -
<select name=id_number tabindex="2">
<?php include "numbers.php"; ?></select></p>
<p align="center">This vote's one-line summary: <INPUT size=40 name=subject tabindex="3" value="i.e.- 'Sample text" onfocus="this.value = '';"></p>
<p><h2>Step 2: Define the Voting Period</h2></p>
<p align="center">This vote ends on:<br>
<select size="1" name="day" tabindex="4">
<option>Choose a day...</option>
<option>Sunday</option>
<option>Monday</option>
<option>Tuesday</option>
<option>Wednesday</option>
<option>Thursday</option>
<option>Friday</option>
<option>Saturday</option></select>,
<select size="1" name="month" tabindex="5">
<option>Choose a month...</option>
<option value="Jan.">January</option>
<option value="Feb.">February</option>
<option value="Mar.">March</option>
<option value="Apr.">April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option value="Aug.">August</option>
<option value="Sept.">September</option>
<option value="Oct.">October</option>
<option value="Nov.">November</option>
<option value="Dec.">December</option></select>
<select size="1" name="date" tabindex="6">
<option>Choose a date...</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option></select>,
<select size="1" name="year" tabindex="7">
<option>Choose a year...</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option></select></p>
<p align="center">The results will be announced on:<br>
<select size="1" name="day1" tabindex="8">
<option>Choose a day...</option>
<option>Sunday</option>
<option>Monday</option>
<option>Tuesday</option>
<option>Wednesday</option>
<option>Thursday</option>
<option>Friday</option>
<option>Saturday</option></select>,
<select size="1" name="month1" tabindex="9">
<option>Choose a month...</option>
<option value="Jan.">January</option>
<option value="Feb.">February</option>
<option value="Mar.">March</option>
<option value="Apr.">April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option value="Aug.">August</option>
<option value="Sept.">September</option>
<option value="Oct.">October</option>
<option value="Nov.">November</option>
<option value="Dec.">December</option></select>
<select size="1" name="date1" tabindex="10">
<option>Choose a date...</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option></select>,
<select size="1" name="year1" tabindex="11">
<option>Choose a year...</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option></select></p>
<p><h2>Step 3: Ensure an Accurate Vote</h2></p>
<p>To ensure that a vote is taken accurately, you must enter on this form the number of eligible voters, and the number of votes that are required for the vote to pass from that pool of voters.</p>
<p>Count the number of voters on that list and choose that number from the field below:</p>
<table align =center>
<tr>
<td>Number of eligible voters:</td>
<td><select size="1" name="no_of_voters" tabindex="12">
<option>Choose a number...</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option></select></td>
</tr>
</table>
<p>Now take the number from the field above and multiply that number by ".6" (use a calculator, of course). If it comes out to be a decimal, round up to the nearest whole number (i.e.- 7.3 becomes 8). Choose that number from the field below:</p>
<table align =center>
<tr>
<td>Number of votes required for<br>the measure to pass:</td>
<td><select size="1" name="req_votes" tabindex="13">
<option>Choose a number...</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option></select></td>
</tr>
</table>
<p><h2>Step 4: Create the Subject</h2></p>
<p>This is the full question that the vote is announcing. It should expand on the "one-line summary" you entered above, and be <em>in the form of a question</em>.</p>
<table align="center">
<tr>
<td>Please state the vote question:</td>
<td><TEXTAREA name=question rows=4 wrap=virtual cols=30 tabindex="14" onfocus="this.value = '';">i.e.- "Do you agree that such-and-such should happen?"</TEXTAREA></td>
</tr>
</table>
<p align="center"><INPUT type=submit value="Submit the Vote" tabindex="15">
<INPUT type=reset value="Clear the Form" tabindex="16"></p></form>
</div>
<?php include "../../inc/footer.php"; ?>
And here's the template php that processes the e-mail:
<?php
$Dt=date ('l dS of F, Y - h:i A');
$Email_BODY="VOTE INFORMATION:
- This vote is identified as: CC$id_year-$id_number
- This vote closes at: $day, $month $date, $year
- This vote's results will be announced by: $day1, $month1 $date1, $year1
- To pass, this vote requires: $req_votes of $no_of_voters available votes.
The question posed is as follows: $question";
$resstr=stripcslashes($Email_BODY);
mail($recipient, $subject, $resstr, "From: $email");
/* USE THIS Variable $Email_BODY as email text to send data as email */
?>
So how do I put all those parameters into the subject line? Any help is much appreciated!