Forums

Complex Form - Custom Content, Unique ID, HTML

Mizpah 10 Apr, 2008
Hi There!

Some of you may recall I posted a rather long string of posts a while back, whilst trying to understand Chronoforms, all from the perspective of a non programmer.

Well, despite the delays (caused by the delay of the game), thanks to a lot of help from Grey and others here are the initial results and a basic writeup of various elements in the hope that it helps others.

Platform:

Joomla 1.5, Chronoengine RC2 for 1.5

Aim:

A user visits the enigma website, and from the recruitment page launches the form. This form is customised to the class that the user is applying as, and the demand level. The details are then submitted to the database, and the user recieves an HTML email back which includes a unique ID. The subject line of the message is also customised with multiple fields from the form.

Link:

http://www.enigmaguild.org/index.php?option=com_content&view=article&id=2&Itemid=2

Well although there is more to do, with the above description as 'phase1' its now complete - and I would welcome feedback and advice!

The code, and my comments will follow in the next post.

Mizpah
Mizpah 10 Apr, 2008
Here the code as it stands as of today:

Main form:

<form>

<!-- inpage CSS! -->
<style type="text/css">

form {
  margin: 1em 1em 1em 1em;
}

div.lineup {
 clear: left;
 margin: 0 0 0.5em 0;
}
 
.lineup label {
  width: 6em; 
  float: left;
  text-align: right;
  margin-right: 0.5em;
  display: block;
}
</style> 
<!-- end in page CSS-->

<!--hidden fields to trap url values into the database and into the html email responce-->
<input id="class" name="class" type="hidden" value="<?php echo $_GET["class"]?>"/>
<input id="demand" name="demand" type="hidden" value="<?php echo $_GET["demand"]?>"/>
<input id="subject" name="subject" type="hidden"/>
<!--end hidden field-->

<div id="">
<h1>Enigma Application Form</h1>
<div>
<span class="alert">
<p>This form is currently in Beta!  No, nothing to do with the AoC Beta before you ask!  We are currently updating the form and the emails the form sends when you apply before allowing external applications.  Therefore any forms that are submitted will be ignored, however we would invite you to do so, in order to help us test the new system!</p>
</span>
<br />
<h3>Welcome to our application form!</h3>
<div class="mainintro">
<p>Before you get too carried away with form filling, we have detected that you are applying as a <b><?php echo $_GET["class"]?></b>.<br /></p>
<br />
<p>Please ensure this is correct, as we have tailored your application form accordingly! If this happens to be incorrect please go back and pick the correct link in the recruitment module. We can also see that the recruitment status for your class is listed as
<?php
switch ($_GET["demand"]) {
case 'High':
echo " <font color=\"#00CC00\"><b>high</b></font>.</p><p>This means that we have launched a priority recruiting drive for your class! If after 48 hours you have heard nothing further, then please contact one of our officers in game to check on the status of your application.";
break;
case "Medium":
echo " <font color=\"#FFCC00\"><b>medium</b></font>.</p><p>This means that we are recruiting at least 3 applicants for your class. If after 5 days you have heard nothing further, then please contact one of our officers in game to check the status of your application.";
break;
case "Low":
echo " <font color=\"#FF6600\"><b>low</b></font>.</p><p>This means that we are only looking for one or two, probably exceptional applicants!  Please give us 7 days to review your application. If you are not accepted at this time, we may keep your application on file, for review when the application status changes for your class.";
break;
default:
echo " <font color=\"#ff0000\"><b>closed</b></font>.</p><p>Therefore you are very unlikely to hear anything back from us.  However your application will be left in our database,  and we do check the database for people to talk-to before reopening recruitment for a given class.";
}
?>
</p>
</div>
<br />
<h4>So good luck, and happy form filling!</h4>
<!-- Closes the form introduction -->
<br />
<br />

<!--Start New Section -->
<!-- Section Title -->
<h2>About You:</h2>
<!-- Section Intro -->
<div class="sectionintro">
<p>This section is all about you! I know that some people like to keep these details private, however we are much about a sense of community as are the games we play!</p>
</div>
<br />

  
<!-- Start Name Item -->
<h3>Your Name:</h3>
<p class="instruct">Please provide your real name.</p>
<div class="lineup"> 
<label for="field1">First:</label><input id="field1" name="forename" class="field text" size="12" tabindex="1" value=""/><br />
<label for="field2">Last:</label><input id="field2" name="surname" class="field text" size="12" tabindex="2" value=""/>
</div>
<br />
<br /> 
<!-- End  Name Item -->

 
<!-- Start Email Item -->
<h3>Your Email:</h3>
<p class="instruct">Please enter a valid email address that we can contact you on!</p>
<div class="lineup">
<label for="field3">Email:</label><input id="field3" class="field text" name="email" tabindex="3" maxlength="255" value=""/> 
</div>
<br />
<br />
<!-- End Email Item -->

 
<!-- Start Nationality Item -->
<h3>Your Country:</h3>
<p class="instruct">Please provide your Country of residence, this helps to give us an idea of timezones and it's nice to know how spread out we are!</p>
<div class="lineup">
<label for="field4">Country:</label><input id="field4" class="field text" name="nation" tabindex="4" maxlength="255" value=""/> 
</div>
<br />
<br />
<!-- End Nationality Item -->

 
<!-- starts Age Item -->
<h3>Your Age:</h3>
<p class="instruct">Please provide your current age, we only accept new applicants who are over 18!</p>
<div class="lineup">
<label for="field5">Age:</label><input id="field5" class="field text" name="age" tabindex="5" maxlength="255" value=""/> 
</div>
<br />
<br />
<!-- End Age Item -->
 
 
<!-- Start 'All About You' item -->
<h3>All About You:</h3>
<p class="instruct">Tell us somthing about you!  Where do you live ? What do you do ? Do you like cheese ? <br /> Make us laugh, amaze us, make us cry or even scare us! Its your choice.</p>
<div>	
<textarea id="field6" class="field textarea" name="about_you" rows="10" cols="60" tabindex="6"></textarea>
</div>
<br />
<br />
<!-- End 'All about you item' -->
 
<span class="blockquote">Now for a few basic sanity checks, please don't just pay lip service to these, we do check!</span> 

<!--Guild Rules Item -->
<h3>The Guild Rules:</h3>
<p class="instruct">Please make sure that you have both read, <i>(properly, there might even be a test!),</i> and agree with the guild rules. If you have any specific questions on the guild rules, feel free to ask an officer in game, or via the forums prior to applying.</p>
<div>
<input id="field7" name="guild_rules" class="field radio" type="radio" tabindex="7" value="Yes"/>
<label class="choice" for="field7">Yes - I agree to, and have read all of the guild rules.</label><br />
<input id="field7" name="guild_rules" class="field radio" type="radio" tabindex="8" value="No"/>
<label class="choice" for="field7">No - I have not yet read the guild rules.</label>
</div>
<br />
<br />
<!--End Guild Rules Item -->
 
 
<!--English Item -->
<h3>The Guild Language:</h3>
<p class="instruct">We are, and always will be - a very international guild. However to aid communication, and minimise misunderstandings, we insist that people communicate in English, both in game and via Ventrilo.</p>
<div>
<input id="field8" name="guild_language" class="field radio" type="radio" tabindex="9" value="Yes"/>
<label class="choice" for="field8">Yes - I am comfortable using both spoken and written English</label><br />
<input id="field8" name="guild_language" class="field radio" type="radio" tabindex="10" value="No"/>
<label class="choice" for="field8">No - I am not happy to speak or write in English</label><br />
</div>
<br />
<br />
<!--End English Item-->    
 
 
<!--Vent Item -->
<h3>Use of Ventrilo:</h3>
<p class="instruct">Communication and community are vital in a sucessfull guild. We find that people spending time together in Ventrilo, even when not in a raid, helps to build community. This for us is a good thing!</p>
<div>
<input id="field9" name="vent" class="field radio" type="radio" tabindex="11" value="Yes, With Mic"/>
<label class="choice" for="field9">Yes - I am happy to use ventrilo, and have and will use a microphone.</label><br />
<input id="field9" name="vent" class="field radio" type="radio" tabindex="12" value="Yes, No microphone."/>
<label class="choice" for="field9">Yes - I am happy to listen to ventrilo, but do not have a microphone.</label><br />
<input id="field9" name="vent" class="field radio" type="radio" tabindex="13" value="No Vent"/>
<label class="choice" for="field9">No - I am not able to listen to Ventrilo!</label><br />
</div>
<br />
<br />
<!--End Vent  Item-->

 
<!-- Start 'Anything Else' item -->
<h3>Additional Comments:</h3>
<p class="instruct">If you would like to add any comments additional comments, to elaborate on answers in this section, please do so here!</p>
<div>
<textarea id="field10" class="field textarea" name="anything_else" rows="10" cols="60" tabindex="14"></textarea>
</div>
<br />
<h4>Well, that's the end of the 'About You' section, see not too scary!</h4>
<br />
<br />
<!-- End 'Anything Else' item -->    
   

<!--Start New Section -->
<!-- Section Title -->
<h2>Your Character: General Section</h2>
<!-- Section Intro -->
<div class="sectionintro">
<p>This section is all about the in game character you are applying with.  Although having 'alt's' can be usefull, we are all about people's main characters and getting them optimised for raiding. That said, we dont just look at your stats, a good attitude and a willingness to do things 'the enigma way' is more important to us than someone with a bad attitude and all the greatest gear.</p>
</div>
<br />


<!-- Start Char_name--> 
<h3>Character Name:</h3>
<p class="instruct">Please provide the name of the character you are applying with!</p>
<div class="lineup">
<label for="field20">Name:</label><input id="field20" name="character_name" class="field text" size="12" tabindex="20" value="" />
</div>
<br />
<br />
<!-- End  Char Name Item -->



<!-- Start Char Level--> 
<h3>Character Level:</h3>
<p class="instruct">Please provide the current level of your character.</p>
<div class="lineup">
<label for="field21"><b>Level:</b></label><input id="field21" name="character_level" class="field text" size="3" tabindex="21" />
</div>
<br />
<br />
<!-- End  Char Level Item -->

<!-- Start Basic Stats--> 
<h3>Basic Character Stats</h3>
<p class="instruct">Please provide the following basic unbuffed stats for your character, please ensure that you provide all stats using the same equipment and weapons. Note that for some characters the value for Mana will be zero!</p>

<div class="lineup">
<label for="field22_1"><b>Health:</b></label><input id="field22_1" name="health" class="" size="3" tabindex="22" /><br />
<label for="field22_2"><b>Stamina:</b></label><input id="field22_2" name="stamina" class="" size="3" tabindex="23" /><br />
<label for="field22_3"><b>Mana:</b></label><input id="field22_3" name="mana" class="" size="3" tabindex="24" /><br />
</div>
<br />
<br />
<!-- End  Basic Stats Item -->


<!-- Start Basic Attributes--> 
<h3>Basic Character Attributes</h3>
<p class="instruct">Please provide the following basic unbuffed attributes for your character, please ensure that you provide all stats using the same equipment and weapons.</p>
<div class="lineup">
<label for="field23_1"><b>Strength:</b></label><input id="field23_1" name="strength" class="" size="3" tabindex="25" value="" /><br />
<label for="field23_2"><b>Intelligence:</b></label><input id="field23_2" name="intelligence" class="" size="3" tabindex="26" value="" /><br />
<label for="field23_3"><b>Constitution:</b></label><input id="field23_3" name="constitution" class="" size="3" tabindex="27" value="" /><br />
<label for="field23_4"><b>Dexterity:</b></label><input id="field23_4" name="dexterity" class="" size="3" tabindex="28" value="" /><br />
<label for="field23_5"><b>Wisdom:</b></label><input id="field23_5" name="wisdom" class="" size="3" tabindex="29" value="" /><br />
</div>
<br />
<br />
<!-- End  Basic Attributes Item -->


<!-- Start Basic Stats--> 
<h3>Combat Stats</h3>
<p class="instruct">Please provide the following basic combat stats:</p>
<div class="lineup">
<label for="field24_1"><b>Com_1:</b></label><input id="field24_1" name="attack" class="" size="3" tabindex="30" /><br />
<label for="field24_2"><b>Com_2:</b></label><input id="field24_2" name="defence" class="" size="3" tabindex="31" /><br />
<label for="field24_3"><b>Com_3:</b></label><input id="field24_3" name="magic" class="" size="3" tabindex="32" /><br />
</div>
<br />
<br />
<!-- End  Basic Stats Item -->


<!-- Start 'Resistances & Invulnerabilities' item --> 
<h3>Resistances & Invulnerabilities:</h3>
<p class="instruct"> The following are optional stats you may wish to fill in. These become more relevent at higher levels, and are primarily aimed at people who are maximum level and looking for raiding spots.</p>
<h4>Resistances:</h4>
<br />
<div class="lineup">
<label for="field25_1"><b>Res_1:</b></label><input id="field25_1" name="magic_res" class="" size="3" tabindex="33" value="" /><br />
<label for="field25_2"><b>Res_2:</b></label><input id="field25_2" name="fire_res" class="" size="3" tabindex="34" value="" /><br />
<label for="field25_3"><b>Res_3:</b></label><input id="field25_3" name="cold_res" class="" size="3" tabindex="35" value="" /><br />
<label for="field25_4"><b>Res_4:</b></label><input id="field25_4" name="elec_res" class="" size="3" tabindex="36" value="" /><br />
<label for="field25_5"><b>Res_5:</b></label><input id="field25_1" name="holy_res" class="" size="3" tabindex="37" value="" /><br />
<label for="field25_6"><b>Res_6:</b></label><input id="field25_2" name="unholy_res" class="" size="3" tabindex="38" value="" /><br />
<label for="field25_7"><b>Res_7:</b></label><input id="field25_3" name="poison_res" class="" size="3" tabindex="39" value="" /><br />
</div>
<br />
<h4>Invulnerabilities:</h4>
<div class="lineup">
<label for="field26_1"><b>Inv_1:</b></label><input id="field26_1" name="slash_inv" class="" size="3" tabindex="40" value="" /><br />
<label for="field26_2"><b>Inv_2:</b></label><input id="field26_2" name="pierce_inv " class="" size="3" tabindex="41" value="" /><br />
<label for="field26_3"><b>Inv_3:</b></label><input id="field26_3" name="crush_inv" class="" size="3" tabindex="42" value="" /><br />
<label for="field26_4"><b>Inv_4:</b></label><input id="field26_4" name="fire_inv" class="" size="3" tabindex="43" value="" /><br />
<label for="field26_5"><b>Inv_5:</b></label><input id="field26_1" name="cold_inv" class="" size="3" tabindex="44" value="" /><br />
<label for="field26_6"><b>Inv_6:</b></label><input id="field26_6" name="elec_inv" class="" size="3" tabindex="45" value="" /><br />
<label for="field26_7"><b>Inv_7:</b></label><input id="field26_7" name="holy_inv" class="" size="3" tabindex="46" value="" /><br />
<label for="field26_8"><b>Inv_8:</b></label><input id="field26_8" name="unholy_inv" class="" size="3" tabindex="47" value="" /><br />
<label for="field26_9"><b>Inv_9:</b></label><input id="field26_9" name="poison_inv" class="" size="3" tabindex="48" value="" /><br />
</div>
<br />
<br />
<!-- End 'Resistances & Invulnerabilities' item -->  


<!-- Start 'Your Equipment' item -->
<h3>Your Equipment:</h3>
<p class="instruct">Please describe your equipment and weapons here, Go into as much detail as you feel is relevent.</p>
<div>
<textarea id="field24" class="field textarea" name="equipment" rows="10" cols="60" tabindex="49"></textarea>
</div>
<br />
<br />
<!-- End 'Your Equipment' item -->

<h4>Thats the end of the Your Character section, only one more to go!</h4>
<br />
<br />

<!-- New Section -->
<!-- Section Title -->
<h2>Your Character: Class Specific Questions</h2>
<!-- Section Intro -->
<div class="sectionintro">
<p>This section contains questions specific to the <b><?php echo $_GET["class"]?></b> class and to your build! As we become increasingly aware of the differentiation between the classes at high levels, we will refine the questions in this section accordingly.</p>
</div>
<br />


<!--Class Specifc Feat Tree Item -->
<h3>Your Feats:</h3>
<p class="instruct">Please look at your feat tree, and indicate how you are <b>currently</b> predominately configured.<br />
<br />
<?php
   switch ($_GET["class"]){
   case 'Guardian':
?>
<!--Guardian-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Juggernaught"/><label class="choice" for="field30_1">Juggernaught Build</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Tempest"/><label class="choice" for="field30_2">Tempest Build</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Guardian -->

<?php
  break;
   case 'Conqueror':
?>
<!--Conqueror-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Conqueror Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Conqueror Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Conqueror -->

<?php
   break;
   case 'Dark Templar':
?>
<!--Dark Templar-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Dark Templar Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Dark Templar Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Dark Templar -->

<?php   
   break;
   case 'Priest of Mitra':
?>
<!--Mitra-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Priest of Mitra Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Priest of Mitra Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Mitra -->

<?php
   break;
   case 'Tempest of Set':
?>
<!--Set-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Tempest of Set Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Tempest of Set Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Set -->

<?php
   break;
   case 'Bear Shamen':
?>
<!--Shamen-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Bear Shamen Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Bear Shamen Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Shamen -->

<?php
   break;
   case 'Barbarian':
?>
<!--Barbarian-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Barbarian Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Barbarian Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Barbarian -->

<?php
   break;
   case 'Assassin':
?>
<!--Assassin-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Assassin Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Assassin Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Assassin -->

<?php
   break;
   case 'Ranger':
?>
<!--Ranger-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat tree A"/><label class="choice" for="field30_1">Ranger Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Ranger Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Ranger -->

<?php
   break;
   case 'Necromancer':
?>
<!--Necromancer-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Necromancer Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Necromancer Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--End Necromancer-->

<?php
   break;
   case 'Herald of Xotli':
 ?>
<!--Xotli-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Herald of Xotli Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Herald of Xotli Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--Xotli -->

<?php
   break;
   case 'Demonologist':
?>
<!--Demonologist-->
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="50" value="Feat Tree A"/><label class="choice" for="field30_1">Demonologist Build A</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="51" value="Feat Tree B"/><label class="choice" for="field30_2">Demonologist Build B</label><br />
<input id="field30" name="feat_tree" class="field radio" type="radio" tabindex="52" value="Hybrid"/><label class="choice" for="field30_3">Hybrid Build</label><br />
<br />
<!--Demonologist-->

<?php
   break;
   default:
   echo "Hmm, We seem not to have been able to detect a class! Have you followed a valid link ? Please try again and contact webmaster@enigmaguild.org if this problem persists!";
}
?>

<br />
<br />
<!--End of Feat tree content -->


<!-- Start 'Your Build' item -->
<h3>Your Build:</h3>
<p class="instruct">Please now describe your planned (or current if level 80!) build here.  Why have you made the choices you have made ? What are the strengths and advantages of your build choices ?</p>
<div>
<textarea id="field31" class="field textarea" name="your_build" rows="10" cols="60" tabindex="53"></textarea>
</div>
<br />
<br />
<!-- End 'Your Build' item --> 


<!-- Start 'Skills' item -->
<h3>Skills:</h3>
<p class="instruct">If you feel that its relevent, please provide more details on your skills, and skill choices here. Please note that this is optional, and geared towards maximum level players and raiding.</p>
<div="">
<textarea id="field32" class="field textarea" name="skills" rows="10" cols="60" tabindex="54"></textarea>
</div>
<br />
<br />

<!-- End Skills item -->

<h4>Thats the end of the class specific questions, now just one more section to answer!</h4>
<br />
<br />

<!-- New Section -->
<!-- Section Title -->
<h2>Your Playstyle & Final Thoughts:</h2>
<!-- Section Intro-->
<div class="sectionintro">
<p>You are onto the home stretch now!  We now want to know more about what makes you tick.  This is your chance to make your application stand out!</p><br />
<p>Why are you choosing Enigma?  Why should Enigma choose you?  Use this section with some thought, and help us to answer those questions when we consider your application!  The last question in this section is your 'sales pitch', we always look at 'Final Thoughts' carefully.  However be very aware, we prefer honesty to fairytales!</p>
</div>
<br />

<!--Start 'Your Primary Focus' item-->
<h3>Your Primary Focus:</h3>
<p class="instruct">In terms of Playstyle, What is the one single focus that is most important to you?</p>
<div class="">
<input id="field40" name="primary_focus" class="field radio" type="radio" value="PvE -Questing" tabindex="80"  /><label class="choice" for="field40">PvE - Questing</label><br />
<input id="field40" name="primary_focus" class="field radio" type="radio" value="PvE - Small Groups" tabindex="81"  /><label class="choice" for="field40">PvE - Small Groups</label><br />
<input id="field40" name="primary_focus" class="field radio" type="radio" value="PvE - Raiding" tabindex="82"  /><label class="choice" for="field40">PvE - Raiding</label><br />
<input id="field40" name="primary_focus" class="field radio" type="radio" value="PvP - General" tabindex="83"  /><label class="choice" for="field40">PvP - General</label><br />
<input id="field40" name="primary_focus" class="field radio" type="radio" value="PvP - Sieges" tabindex="84"  /><label class="choice" for="field40">PvP - Sieges</label><br />
<input id="field40" name="primary_focus" class="field radio" type="radio" value="Crafting" tabindex="85"  /><label class="choice" for="field40">Crafting</label><br />
<input id="field40" name="primary_focus" class="field radio" type="radio" value="Roleplay" tabindex="86"  /><label class="choice" for="field40">Roleplay</label><br />
</div>
<br />
<br />
<!--End 'Your Primary Focus' item-->


<!--Start 'Playstyles' item-->
<h3>Your Playstyle:</h3>
<p class="instruct">Now please select all of the styles of play that interest you, and then provide some elaboration in the text box underneath.</p>
<div class="">
<input id="field41" name="play_1" class="field checkbox" type="checkbox" value="Yes" tabindex="87"  /><label class="choice" for="field41">PvE - Questing</label><br />
<input id="field42" name="play_2" class="field checkbox" type="checkbox" value="Yes" tabindex="88"  /><label class="choice" for="field42">PvE - Small Groups</label><br />
<input id="field43" name="play_3" class="field checkbox" type="checkbox" value="Yes" tabindex="89"  /><label class="choice" for="field43">PvE - Raiding</label><br />
<input id="field44" name="play_4" class="field checkbox" type="checkbox" value="Yes" tabindex="90"  /><label class="choice" for="field44">PvP - General</label><br />
<input id="field45" name="play_5" class="field checkbox" type="checkbox" value="Yes" tabindex="91"  /><label class="choice" for="field45">PvP - Sieges</label><br />
<input id="field46" name="play_6" class="field checkbox" type="checkbox" value="Yes" tabindex="92"  /><label class="choice" for="field46">Crafting</label><br />
<input id="field47" name="play_7" class="field checkbox" type="checkbox" value="Yes" tabindex="93"  /><label class="choice" for="field47">Roleplay</label><br />
</div>
<br />
<div>
<textarea id="field48" class="field textarea" name="playstyle" rows="10" cols="60" tabindex="94"></textarea>
</div>
<br />
<br />
<!--End 'Playstyles' item-->



<!--Start 'Aims & Ambitions' item-->
<h3>Aims & Ambitions:</h3>
<p class="instruct">Describe your aims and ambitions in Hyboria</p>
<div>
<textarea id="field49" class="field textarea" name="aims" rows="10" cols="60" tabindex="95"></textarea>
</div>
<br />
<br />
<!--End 'Aims & Ambitions' item-->

<!--Start 'Availability' item-->
<h3>Availability:</h3>
<p class="instruct">How many hours a week do you typically play? When are you usually available? If you quote times, please do so in GMT.</p>
<div>
<textarea id="field50" class="field textarea" name="availability" rows="10" cols="60" tabindex="96"></textarea>
</div>
<br />
<br />
<!--End 'Availability' item-->


<!-- Start 'Final Thoughts' item -->
<h3>Final Thoughts:</h3>
<p class="instruct"> Here's the one we mentioned in the intro.  You can put anything you like in here!</p>
<div>
<textarea id="Field51" class="field textarea" name="final_thoughts" rows="10" cols="60" tabindex="97"></textarea>
</div>
<br />
<br />
<!-- End 'Final Thoughts' item -->     


<h4>By Crom and Ymir, you are done!</h4><br />
<p><i>Please now press submit to send your application to us, we will confirm your application details back to you via the email address you supplied. In addition we will be in contact in the way we described in the introduction to this form, please note those details and stick to them!</i></p>
 
 
<!-- Start the Submit button! (Change nothng below this line!) -->
<input id="saveForm" class="" type="submit" tabindex="98" value="Submit"/>
<!-- close the div which is the whole container!-->
</div>
<!--close the form! -->
</form>


On Submit (Before Sending Email)

<?php $_POST['subject'] = "Application from " .$_POST['character_name']. " a level " .$_POST['character_level']. " " .$_POST['class']?>
 
<?
$cf_id = 0;
$query = "SHOW TABLE STATUS LIKE 'jos_chronoforms_1'";
$result = mysql_query($query) or die ( "Query failed: " . mysql_error() . "
" . $query );
$row = mysql_fetch_assoc($result);
$cf_id = $row['Auto_increment'];
$html_message = str_replace( "#####", $cf_id, $html_message);
?>


The HTML Template:

<html>
<head>
<title>Enigma Guild Application Form</title>
</head>
<body bgcolor="#000000" topmargin="0" marginheight="0">



<!-- CSS in BODY for cases when HEAD tags are stripped -->
<style type="text/css">

<!--
a:link {font-size:12px;color:#bb0000; text-decoration:none;}
a:visited {font-size:12px;color:#bb0000; text-decoration:none;}
a:active {font-size:12px;color:#bb0000; text-decoration:none;}
a:hover {font-size:12px;color:#ee0000; text-decoration:underline;}
a.fineTxtLink {font-size:10px}
.fineTxt {color:#777777;}
p {font-size:12px; color:#613f0a; font-family:arial, verdana; line-height:1.3em;}
td {font-size:12px; color:#613f0a; font-family:arial, verdana; line-height:1.3em;}
img {font-size:14px; color:#ffffff; font-family:arial, verdana; font-weight:bold;}
.hdr {font-size:16px; font-weight:bold; line-height:.6em;}
.initCap {font-family:"Times New Roman", Times, serif; font-size:22px; font-style:italic; font-weight:bold;}
.flag {padding-right:8px;}
-->
</style>




<table width="450" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td valign="top" width="450" class="hdr"><font color="#ffffff"><strong><img src="http://www.enigmaguild.org/templates/rt_dimensions_j15/images/email/applicationtop.gif" width="450" height="87" border="0"></strong></font></td>

</tr>
<tr>
<td valign="top" bgcolor="#f7e5bd" width="450" background="http://www.enigmaguild.org/templates/rt_dimensions_j15/images/email/center.gif">

<p style="padding-left:25px; padding-right:25px; padding-top:20px;">


Welcome {character_name}!
<br><br>
We have recently recieved your application form, these are <b>some</b> of the details you sent us:
<br><br>
<b>Firstly some details about you.</b>
<br><br>
<b>Your Name:</b> {forename} {surname}<br>
<b>Your Age:</b> {age}<br>
<b>Resident in:</b> {nation}<br>
<br><br>
<b>We asked all about you. You said:</b><br>
{about_you}
<br><br>
<b>We asked you if you had read the guild rules. You said:</b> {guild_rules}.
<br><br>
<b>We then asked if you were happy using english, you said:</b> {guild_language}.
<br><br>
<b>We then asked if you were happy using ventrilo, you said:</b> {vent}.
<br><br>
<b>To close out this first section, we then asked if there was anything else you wanted to add. You said:</b><br>
{anything_else}
<br><br>
We then asked about your character, <b>{character_name}</b>, a <b>{class}</b>.
<br><br>
{character_name} is currently level {character_level}. The main stats that you provided were: <br>
<br>
<b>Health:</b> {health}<br>
<b>Stamina:</b> {stamina}<br>
<b>Mana:</b> {mana}<br>
<b>Strength:</b>{strength}<br>
<b>Intelligence:</b> {intelligence}<br>
<b>Constitution:</b> {constitution}<br>
<b>Dexterity:</b> {dexterity}<br>
<b>Wisdom:</b> {wisdom}<br>
<b>Attack:</b> {attack}<br>
<b>Defence:</b> {defence}<br>
<b>Magic:</b> {magic}<br>
<br><br>
We asked you about your feat tree, you are currently set up as a <b>{feat_tree}</b> build.<br>
<b> We asked you to elaborate on this, and you said:</b><br>
{your_build}
<br><br>
We then wanted to find out a little more about what makes you tick. So to that end we asked the following questions: <br><br>
<b>What is your primary focus in game, you said:</b><br>
{primary_focus}
<br><br>
<b>We then asked you to elaborate on your style of play, you said:</b><br>
{playstyle}
<br><br>
<b>We then asked for your aims and ambitions in game. You said:</b><br>
{aims}
<br><br>
<b>Finally we asked you if you had any other thoughts, or points you wanted to make. You said:</b><br>
{final_thoughts}
<br><br><br>
So thats your application done, what next ? You have been assigned a tracking number for your application, it is <b><font color="Red">#####</font></b>.
<br><br> 
We will soon be providing details on the recruitment page of how you can use this ID to look up the status of your application.
<br><br>
Thanks for applying!
<br><br>
<b>The Officers of Enigma</b>
</p>

</td>
</tr>
<tr>
<td valign="top" width="450"><img src="http://www.enigmaguild.org/templates/rt_dimensions_j15/images/email/bottom.gif" width="450" height="69" border="0"></td>
</tr>



<tr><td>


<center>
<table width="450" cellpadding="0" cellspacing="0" border="0" align="left">
<tr>

<td bgcolor="#000000" valign="top" align="center"><br>
<a href="http://www.enigmaguild.org"><font color="#ffffff"><strong><img src="http://www.enigmaguild.org/templates/rt_dimensions_j15/images/email/enigmalogo.gif" width="" height="" border="0" alt="Enigma Logo"></strong></font></a>
</td>
</tr>
</table>
</center>
</td></tr>
</table>


</body>
</html>


It would be nice if you could set the code boxes to scroll so they arent quite so long!<br><br>Post edited by: Mizpah, at: 2008/04/10 13:30
Mizpah 10 Apr, 2008
Hopefully the code makes sense, but heres a few things that might be relevent - if you need these line numbers I suggest you post the code into notepad++, or a program of your choice!

Using url values:

I have the values for 'class' and 'demand' to drive differing text and queries, depending on how the form is launched. So how do they get 'found' ?

Well heres an example URL link (the example is on more than one line just to make it readable here):

http://www.enigmaguild.org/index.php
?option=com_chronocontact
&chronoformname=application_form
&archetype=Soldier
&class=Conqueror
&demand=Medium

&class=Conqueror is the relevent bit.

By placing <?php echo $_GET["class"]?> within my form, I return 'Conqueror' as the value to the form.

if you look at the intro to my form, line 40, you will see a simple example of including this result in a form.

Using a value to pick specific content:

So we can include a value, but what if the content elsewhere in the form is to change, based on this value ?

well look at this section: (lines 43-57)
<?php
switch ($_GET["demand"]) {
case 'High':
echo " <font color=\"#00CC00\"><b>high</b></font>.</p><p>This means that we have launched a priority recruiting drive for your class! If after 48 hours you have heard nothing further, then please contact one of our officers in game to check on the status of your application.";
break;
case "Medium":
echo " <font color=\"#FFCC00\"><b>medium</b></font>.</p><p>This means that we are recruiting at least 3 applicants for your class. If after 5 days you have heard nothing further, then please contact one of our officers in game to check the status of your application.";
break;
case "Low":
echo " <font color=\"#FF6600\"><b>low</b></font>.</p><p>This means that we are only looking for one or two, probably exceptional applicants!  Please give us 7 days to review your application. If you are not accepted at this time, we may keep your application on file, for review when the application status changes for your class.";
break;
default:
echo " <font color=\"#ff0000\"><b>closed</b></font>.</p><p>Therefore you are very unlikely to hear anything back from us.  However your application will be left in our database,  and we do check the database for people to talk-to before reopening recruitment for a given class.";
}
?>
Here we use a case statement, set to the result of the 'get'. So depending on the value, we can display en entirely differing piece of text. However thats just a simple example, later on in the form (lines 320 to 465) the questions being asked change, as a result of a 12 way 'case', however the principle is the same! In the above example also note the use of 'default', a responce given if the case statement is not 'met' - i.e there is no url value for the 'get' to find.


The HTML template - Hidden fields:

The HTML template also has a couple of quirks, note that we do not ask for class, (after all we know this form the URL and the 'get' statement), but we still want to use the value for class in the email.

As such we need to include it in the form, as a hidden input, so that we can use {class} in the template. This is done on line 26, and again on line 27 for 'demand'.


Customised Subject Lines:

Now we get a bit more interesting. When you fill a form in it gets emailed to you, and to the guild officers with a subject line 'Application from {character_name}, a level {level} {class}' or as an example, 'application from Goldilocks, a level 65 Assassin'.

To achive this we do the following.

Create a hidden field on the form called 'subject' with no value (line 28)

Put this code:

<?php $_POST['subject'] = "Application from " .$_POST['character_name']. " a level " .$_POST['character_level']. " " .$_POST['class']?>


In the onsubmit before sending email

Put the value 'subject' in the subject field, under special fields, in form managment.

In effect what happens is the php code sets the value of the hidden field 'subject' with the content of php string in the form. Note how class has already been set as a value in the form, and the other questions are asked directly.

The special fields use of the value 'subject' takes the content of field in the form, and uses it as you could any other single value, except here you have alreaqdy concatinated the value you want.

Adding a unique ID to each email:

I have added a unique ID to each email (using {ct_id} from the database. This solution was not mine, and is lifted direct from another post, but is here for clarity.

Because the ID is added to the database 'after' the email is sent, you cant just put {ct_id} into the email template and have it work. In this example the following code is used to achive that effect:
<?
$cf_id = 0;
$query = "SHOW TABLE STATUS LIKE 'jos_chronoforms_1'";
$result = mysql_query($query) or die ( "Query failed: " . mysql_error() . "
" . $query );
$row = mysql_fetch_assoc($result);
$cf_id = $row['Auto_increment'];
$html_message = str_replace( "#####", $cf_id, $html_message);
?>


(Grey, please correct me if wrong here, this is how I have interpreted your code!)

The code here sets the $cf_id to 0. Then performs an SQL query to get the table with your form submissions in, and queries the number of rows, setting it to $row. $cf_id is then set to the value of $row+1.

The result of which should be the eventual $cf_id of the form when submitted.

However there is one more wrinkle, $cf_id is not set on the form, so within the html it looks for '#####' and replaces it with the result of the look up.

If you look on line 97 of the html template you will see the ##### that gets replaced!

Those would seem to be the main points that may be of interest, I am sure there may be better ways of doing what I have done, but thats what I have managed to implement so far, and thats pretty much all due to help recieved on these forums, hopefully this post will help others who wish to do the same!

I see lots of posts from people who don't code, wondering how far they can get with chronoforms, hopefully this will help to put your mind at rest, as I didnt even know how to write an html form when I started.

Thanks again to all at chrono, I heartily endorse the purchase of the same.

Mizpah

Post edited by: Mizpah, at: 2008/04/10 14:15<br><br>Post edited by: GreyHead, at: 2008/04/14 09:31
Max_admin 11 Apr, 2008
Thank you very much Mizpah!!🙂

Sincerely,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jolmeda 06 May, 2008
I tried to use this script... but i changed the fields in the form and it didn't worked. I received the following error:

Illegal variable _files or _env or _get or _post or _cookie or _server or _session or globals passed to script.

Please help me...

In the next post I'm including the file with the form we created. We'll be more than grateful to have any kind of help regarding this.

PLEASE HELP.

Thanks
jolmeda 06 May, 2008
[file name=activemos_el_pensamiento-7f53133af54421d8eb11a84a024b056d.zip size=3168]http://www.chronoengine.com/images/fbfiles/files/activemos_el_pensamiento-7f53133af54421d8eb11a84a024b056d.zip[/file]

PLEASE HELP
GreyHead 07 May, 2008
Hi jolmeda,

I spotted a couple of problems.

You have
value="<?php echo $_GET["demand"]?>"
in your form html. These quotes are mismatched, it needs to be
value="<?php echo $_GET['demand']?>


You also have numbers as field names like - name="4" - these are illegal; name and id attribute values must begin with a letter.

Bob
jolmeda 07 May, 2008
Thanks very much Bob,

That helped my form a lot, but now we are experiencing another error.

No email is sent. But the page is redirected to the correct page with all the data that was submitted in the fields, but the data checked on the checkboxes is not displayed. Please help me.

What do I have to do for this data from the checkboxes to be displayed and sent to the database?

In the next email i'll include the fixed form.

THANKS A LOT.
jolmeda 07 May, 2008
[file name=activemos_el_pensamiento-d67826cf7e4ad6ad107b59177499360a.zip size=3206]http://www.chronoengine.com/images/fbfiles/files/activemos_el_pensamiento-d67826cf7e4ad6ad107b59177499360a.zip[/file]
jolmeda 08 May, 2008
That's what i did, and still not getting the results. 😮(
Max_admin 09 May, 2008
Hi jolmeda,

you mean the whole email is not sent or just the checkboxes part ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 09 May, 2008
Hi jolmeda,

Use {act} instead of {act[]} in the email template box. And you will need to set some values that are more meaningful than 'Yes'

Bob

This topic is locked and no more replies can be posted.