TinyPortal

Development => Block Codes => Topic started by: mebymyself on October 19, 2006, 08:10:13 PM

Title: [Done!] Join Us! form
Post by: mebymyself on October 19, 2006, 08:10:13 PM
I am looking for some kind of form - when the form is submitted it should create new thread in specific forum.

I think somebody should have it - seems to be simple - unfortunatelly I am not PHP expert :(

Thank you in advance

*************  UPDATE ******************

OK I did it by myself  :laugh: - my first TP block and even my first PHP code

The HOW TO is located >>>here<<<< (http://www.tinyportal.net/index.php?topic=9840.msg84957#msg84957)

Updated code by JPDeni will be posted here:
http://www.tinyportal.net/index.php/topic,29670
Title: Re: [Request] Join Us! form
Post by: darthmactis on October 22, 2006, 06:41:52 PM
I have one that i have converted but it send the form to a email not a thread.
Title: Re: [Request] Join Us! form
Post by: mebymyself on October 22, 2006, 06:59:12 PM
can you please post it - maybe I'll can modify it... but getting email isn't bad idea also - I will keep it too
Title: Re: [Request] Join Us! form
Post by: akulion on October 22, 2006, 06:59:18 PM
why dont u simply use the prefilled topics thingie thurnok posted a while back?

ill search and post the link here if i find it :)
Title: Re: [Request] Join Us! form
Post by: akulion on October 22, 2006, 07:00:13 PM
here it is
http://www.tinyportal.net/smf/index.php?topic=9419.0
Title: Re: [Request] Join Us! form
Post by: darthmactis on October 22, 2006, 11:05:04 PM
First download this http://darthmactis.exiledglory.com/files/member app.rar (http://darthmactis.exiledglory.com/files/member%20app.rar) exctract is upload the apply.php to your forums folder, edit the email address in it. then make a new article and put the code in the app forum html code.txt file in the article, then add the article to your menu.

Example here: http://www.exiledglory.com/forums/index.php (http://www.exiledglory.com/forums/index.php) top left menu click the join us then click the join us on the bottom of the article.

this is how i got it to work if there is a better way, do tell!!!
Title: Re: [Request] Join Us! form
Post by: jacortina on October 22, 2006, 11:38:11 PM
Quote from: darthmactis on October 22, 2006, 11:05:04 PM
this is how i got it to work if there is a better way, do tell!!!

Contact Page Mod (http://mods.simplemachines.org/index.php?mod=377)
Title: Re: [Request] Join Us! form
Post by: mebymyself on October 22, 2006, 11:41:52 PM
Quote from: J.A.Cortina on October 22, 2006, 11:38:11 PM
Quote from: darthmactis on October 22, 2006, 11:05:04 PM
this is how i got it to work if there is a better way, do tell!!!

Contact Page Mod (http://mods.simplemachines.org/index.php?mod=377)

And why its better?

darthmactis code is much more close to what i requested ...
I am testing it right now - Also I need different set of fields of course :)
Title: Re: [Request] Join Us! form
Post by: jacortina on October 22, 2006, 11:49:09 PM
It doesn't require that you go in and change the code to specify email to send to. It's made to use the css styling and theme of your forum. It works with the permissions system of SMF.

Frankly, your request wasn't something that could be answered as it lacked a lot of the definition necessary. You gave no details as to the type of form you would want to post to a thread (form values pulled from database for dropdowns and option buttons or s couple of simple fill-in-the-blank fields). You didn't say anything about hoiw it's to be used and by whom (guest posting is different from user posting). You didn't say whether the target board and topic is or is not something the submitter would/should have access to in order to edit.
Title: Re: [Request] Join Us! form
Post by: darthmactis on October 22, 2006, 11:53:14 PM
Quote from: mebymyself on October 22, 2006, 11:41:52 PM
Quote from: J.A.Cortina on October 22, 2006, 11:38:11 PM
Quote from: darthmactis on October 22, 2006, 11:05:04 PM
this is how i got it to work if there is a better way, do tell!!!

Contact Page Mod (http://mods.simplemachines.org/index.php?mod=377)

And why its better?

darthmactis code is much more close to what i requested ...
I am testing it right now - Also I need different set of fields of course :)


let me know if it works for ya
Title: Re: [Request] Join Us! form
Post by: mebymyself on October 23, 2006, 12:51:03 AM
Quote from: J.A.Cortina on October 22, 2006, 11:49:09 PM
Frankly, your request wasn't something that could be answered as it lacked a lot of the definition necessary.

Actually I have no hope that somebody should take this as a SOW and start developing ready-to-use module tailored to my request. Hense I posted some general reqs only.
But just in case if somebody need more specific requirements here they are:
- The form must be used by registred members only (guests cannot access this form)
- Form should consist of several input boxes, check marks  and selection fields. actual fields will be provided if needed but some generic mechanism to post everything on the form is highly desired
- The form should have some simple validation (required fields, "I Agree" checkbox, valid email etc.)
- When form submitted - regular new thread should be created in specific board. The data that user provided should be postet like table or just as fieldname - value pairs.
- As I said it should be regular thread - all rules of the board applied to this post
--------------
I think  it pretty simple - I just don't know database structure good enough to do it by myself. I don't know PHP either - but i got a good book - and hopefully I can modify darthmactis' code to serve all my needs if somebody will give me a push in right direction

BTW darthmactis, I tried your code as is and it do work (mean send an email). now all I need it to creat new topic in the forum...
Title: Re: [Request] Join Us! form
Post by: jacortina on October 23, 2006, 01:03:09 AM
Well, if it's working within the SMF 'rules' for posting (given that you build the message from your form-supplied values), then it's really only a matter of calling the same subroutine that SMF uses to post a new topic. That's the createPost function in Sources/Subs-Post.php (and see the Post2 function in Sources/Post.php to backtrack the construction of the arrays which feed into createPost).

You don't mess directly with the database and a number of default values are supplied.
Title: Re: [Request] Join Us! form
Post by: darthmactis on October 23, 2006, 02:59:57 AM
Quote from: mebymyself on October 23, 2006, 12:51:03 AMBTW darthmactis, I tried your code as is and it do work (mean send an email). now all I need it to creat new topic in the forum...

If i could figure out how to do that i would have LOLLOL
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 04:26:40 PM
Ok,  I went pretty far (i think)

I created the form
able to sent results to email
and figured out what I need to  create a post

But here is showstoper ... when I call to createPost function located in Subs-Post.php I got an error message:

Fatal error: Call to undefined function createPost() in /home/wowaao/public_html/enroll.php on line 102

Definetly I missing something due to my poor knowladge of PHP.
Somebody can help me fix it, please?

The code of  enroll.php is following:



<?php 

global $sourcedir$user_info$context$enroll_errors;

define('SMF'1);
include(
$sourcedir 'Subs-Post.php');

$email_address='recruitment@wow-aao.net';

$board_id=16;
$thank_you_article_id '20';
$enroll_error_article_id '21';

$show_form'true';
if (isset(
$_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email 
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for a name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for a name
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}  

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application 

$subject 'Enrollment Application';
$body 'Enrollment application has been made by ' $context['user']['name'] . 
' from IP Address ' $REMOTE_ADDR '\n 
    Real Name:  ' 
$_POST['real_name'] . '\n
Email address:  ' 
$_POST['email'] . '\n
Current Game Name:  ' 
$_POST['aa_name'] . '\n
Age:  ' 
$_POST['age'] . '\n
Gender: ' 
$_POST['gender'] . '\n
Location:  ' 
$_POST['location'] . '\n
Current Honor:  ' 
$_POST['honor'] . '\n
Previous clan(s):  ' 
$_POST['prev_clans'] . '\n
Banned from any sever:  ' 
$_POST['banned'] . '\n
Registered with AAOTracker? ' 
$_POST['aaotracker'] . '\n
AAOTracker name:  ' 
$_POST['aaotraker_name'] . '\n
Registred with X-fire?  ' 
$_POST['xfire'] . '\n
X-Fire Account:  ' 
$_POST['xfire_name'] . '\n
TeamSpeak installed?:  ' 
$_POST['ts'] . '\n
Have microphone/headset:  ' 
$_POST['mic'] . '\n
Would like to help pay for a server?: ' 
$_POST['pay'] . '\n  
Why do you want to join -WoW-?  ' 
$_POST['why'] . '\n
Gaming habbits:   ' 
$_POST['habbits'] . '\n
Other information:  ' 
$_POST['other'] . '\n' ;

 mail($email_address$subject$body,"From: " $_POST['email']);

//TODO: create new forum post with application

//smf_makePost($context['user']['id'], $context['user']['name'], $_POST['email'], $subject, $body, $icon, $board_id);
// Create a post, either as new topic (ID_TOPIC = 0) or in an existing one.
    // The input parameters of this function assume:
    // - Strings have been escaped.
    // - Integers have been cast to integer.
    // - Mandatory parameters are set.

$msgOptions = array(
'id' =>  ,
'subject' => '[Pending] Application of ' $context['user']['name'],
'body' => $body ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $ID_MEMBER,
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
   
createPost($msgOptions$topicOptions$posterOptions);

// Redirect to thank you page
//header("Location: http://$_SERVER['HTTP_HOST']/index.php?page=$thank_you_article_id");
header('Location: http://' $_SERVER['HTTP_HOST'] .'/index.php?page=' $thank_you_article_id);

} else { 
// Redirect to error page
header('Location: http://' $_SERVER['HTTP_HOST'] . '/index.php?page=' $enroll_error_article_id );
}
} else { 
// Display the form 

?>





<form action="enroll.php" method="post">
                <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="<?php if (isset($_POST['real_name'])) echo $_POST['real_name']; ?>" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="<?php if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email'];  ?>" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current AA In-Game Nick:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="<?php if (isset($_POST['aa_name'])) echo $_POST['aa_name']; ?>" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="<?php if (isset($_POST['age'])) echo $_POST['age']; ?>" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="<?php if (isset($_POST['gender'])) echo $_POST['gender']; ?>" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="<?php if (isset($_POST['location'])) echo $_POST['location']; ?>" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Honor:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="<?php if (isset($_POST['honor'])) echo $_POST['honor']; ?>" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous clan(s):</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="<?php if (isset($_POST['prev_clans'])) echo $_POST['prev_clans']; ?>" ></TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="<?php if (isset($_POST['banned'])) echo $_POST['banned']; ?>" ></TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registered with AAOTracker?</TD>
<TD><SELECT id="aaotraker" name="aaotraker" style="WIDTH: 160px" value ="<?php if (isset($_POST['aaotraker'])) echo $_POST['aaotraker']; ?>" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">AAOTracker name:</TD>
<TD><INPUT id="aaotraker_name" name="aaotraker_name" type="text" value ="<?php if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; ?>" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="<?php if (isset($_POST['xfire'])) echo $_POST['xfire']; ?>" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="<?php if (isset($_POST['xfire_name'])) echo $_POST['xfire_name']; ?>" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have TeamSpeak installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="<?php if (isset($_POST['ts'])) echo $_POST['ts']; ?>" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="<?php if (isset($_POST['mic'])) echo $_POST['mic']; ?>" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="<?php if (isset($_POST['pay'])) echo $_POST['pay']; ?>" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join -WoW-?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="<?php if (isset($_POST['why'])) echo $_POST['why']; ?>" ></TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="<?php if (isset($_POST['habbits'])) echo $_POST['habbits']; ?>" ></TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="<?php if (isset($_POST['other'])) echo $_POST['other']; ?>" ></TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>


<?php
// Close the main IF_ELSE.
?>




Title: Re: [Request] Join Us! form
Post by: jacortina on November 02, 2006, 04:52:52 PM
Try to change:
include($sourcedir . 'Subs-Post.php');

To:
include($sourcedir . '/Subs-Post.php');
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 04:57:21 PM
same error :-\
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 05:03:15 PM
Ok here update ...

when I replaced :
   include($sourcedir . 'Subs-Post.php');

with hardcoded :
require_once( '/home/wowaao/public_html/Sources/Subs-Post.php');

I got different error:
Fatal error: Call to undefined function db_query() in /home/wowaao/public_html/Sources/Subs-Post.php on
line 1559

any idea what else to include?
Title: Re: [Request] Join Us! form
Post by: akulion on November 02, 2006, 05:20:34 PM
include($one_cup_of_coffee and patience);

that may work :2funny:
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 05:23:25 PM
Sure?

I included already lot of coffee and even more patiece ...
But i am serious now...
Title: Re: [Request] Join Us! form
Post by: JPDeni on November 02, 2006, 05:36:32 PM
db_query is in Subs.php

If this is in a TPBlock, you should be able to just use

require_once('Subs.php');
require_once('Subs-Post.php');

The code in the blocks is evaluated from within Load.php, which is in the same directory as the other .php files, so you don't need to put in the directory. Or you can put in the full directory, as you found out. :)
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 05:50:24 PM
after including  Subs.php I went little further but again missing some required functions

here the require_once ... part of the file now:



....

require_once(dirname(__FILE__) . '/Settings.php');
require_once($sourcedir . '/Subs.php');
require_once( $sourcedir .'/Subs-Post.php');
require_once($sourcedir . '/QueryString.php');
require_once($sourcedir . '/Errors.php');
//require_once($sourcedir . '/Load.php');


.....


the error now is:
Fatal error: Call to undefined function cache_get_data() in /home/wowaao/public_html/Sources/Errors.php on line 146

when I uncomment  require_once($sourcedir . '/Load.php');

I got just blank page - no errors ....
Title: Re: [Request] Join Us! form
Post by: JPDeni on November 02, 2006, 06:23:59 PM
Where is this code? Is it in a TP php block or article or is it something external or are you trying to create a new SMF function?
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 06:26:57 PM
well,

Its external enroll.php file wich is included into the article

include('enroll.php');
Title: Re: [Request] Join Us! form
Post by: JPDeni on November 02, 2006, 06:44:07 PM
Have you ever got the form to print out by using the "include" in the article? I've never used anything like that, so I don't know how it would work. I just put my code directly into articles.
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 06:51:21 PM
You can see here (http://wow-aao.net/index.php?page=19) how it works
You need to log in
username:test
password:test
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 06:54:25 PM
actually I tried  to put directly into the article but I dont know how to handle this:



<form action=? ? ? ?  method="post">


Title: Re: [Request] Join Us! form
Post by: Assistance on November 02, 2006, 07:00:10 PM
if u get this working could u repost the entire How To: please
I would like this addition aswell
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 07:02:23 PM
Assistance,
Of course  I will - my little 2 cents to this great software!!!

--------------
probably i will end up just copying sql statements from createPost function into my code and executing it directly
Title: Re: [Request] Join Us! form
Post by: JPDeni on November 02, 2006, 07:09:04 PM
You would just use "index.php?page=19" in the form action tag.

Change
} else { // Display the form

?>

<form action="enroll.php" method="post">

to

} else { // Display the form
 echo '
<form action="index.php?page=19" method="post">


and change



<?php
// Close the main IF_ELSE.
?>


to

} // Close the main IF_ELSE.


and take out that first <?php line. :)

The only thing you need to worry about is if you've got apostrophes in your form. I didn't see any, but I didn't look really close, either.

So you can get the form to print out, except when you include Load.php? That probably won't be a factor if you have it in an article, because it'll already be in Load.php.
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 02, 2006, 07:22:55 PM
Ok, I'll try to put it directly to article
Just ...can you help me to convert those piece of php blocks so it integrates with echo statement?



<TD><INPUT id="real_name" name="real_name" type="text" value ="<?php if (isset($_POST['real_name'])) echo $_POST['real_name']; ?>" /></TD>

Title: Re: [Request] Join Us! form
Post by: JPDeni on November 02, 2006, 07:33:41 PM
Sure. :)

<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 03, 2006, 12:11:28 AM
Hooah!  Thank you all who helped me! It's working!!!

Here how to do "Join Us" recruitment form that upon submittion sends email to the specified address and also create new topic in the specified Board

1. Create PHP article to be redirected to when the form is succesfully submited. Let's call it "Thank You" article
it can be something like this:



global $user_info;
echo "
<h3>Thank you for applying, " . $user_info['name'] . "! </h3><br />
<p>Your application has been sent to our reqruitment officers by email and also new topic has been created on your behave in  Reqruitment Department's forum. <br/>
Our decision will be posted here. You also will recieve an email when the decision will be done.<br/>
Please feel free to add any information you want to share with us.<br/>
<br /></p>";




2. Then create PHP article like this:





global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='recruitement@your-clan.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=16;

//the id of the this article
$this_article_id = '19';

//article to be redirected when form is submitted
$thank_you_article_id = '20';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current AA In-Game Nick:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Honor:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registered with AAOTracker?</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">AAOTracker name:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have TeamSpeak installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join -WoW-?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';




3. In configuration section of the code change the variables with actual values

4. you can modify the look and feel of the form, the post and the email text if you want

That's it ...

I am not PHP expert but if you have problems post here - and I'll try to help .

If you have some suggestions or additions - post it :)
Title: Re: [Request] Join Us! form
Post by: Assistance on November 03, 2006, 02:15:18 AM
//the id of the this article
$this_article_id = '19';

//article to be redirected when form is submitted
$thank_you_article_id = '20';

what if i used a custom action

action=join
???
Title: Re: [Request] Join Us! form
Post by: mebymyself on November 03, 2006, 02:35:01 AM
I don't know how to do it with custom actions.
I believe it will require external php file or modification of template.

All my attempts with external file failed :(  as you can see from this thread
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 02:42:26 AM
umm kinda, i have the custom action mod, so it would simply be copy paste, pretty much the same code.  I'm sure I could be fine with it, just prefer actions so when viewing online list i can that people are joining.
Title: Re: [Done!] Join Us! form
Post by: londonhogfan on November 03, 2006, 05:26:25 AM
http://www.tinyportal.net/smf/index.php?topic=4560.msg40861#msg40861

works pretty good on my site.
http://www.the-rota.com/index.php?page=24 (at the bottom)
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 01:56:10 PM
Quote from: londonhogfan on November 03, 2006, 05:26:25 AM
http://www.tinyportal.net/smf/index.php?topic=4560.msg40861#msg40861

works pretty good on my site.
http://www.the-rota.com/index.php?page=24 (at the bottom)

OMG!!!  Where you were before!!! :-\
I reinvented the wheel and did it in bad manner :uglystupid2: :idiot2:

Ok anyway it was my first attempt to do something like this ::)
Thank you for your input
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 02:09:30 PM
londonhogfan,
Now i see that my code is somehow more useful because i have full control on the process
I noticed on your site it says:
QuoteOnce submitted, it will take you to a pre-formatted post on the member applications board, where you will still need to hit the post button.

My code is totally automated. And also i want to expand it to
1. Do not allow clan members fill the form (obvious but you know as soon as I informed that the form is ready I recieved 3 apps from exicting members :)   ... testing ...)

2. Do not allow double applications. instead it should take to existing post and suggest modify it

3. Create another post in members only forum with poll. This will allow Clan members disscuss pending application and vote.
 
Title: Re: [Done!] Join Us! form
Post by: akulion on November 03, 2006, 02:30:20 PM
Thanks everyone for the great code :up:
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 02:32:32 PM
Quote from: Aku on November 03, 2006, 02:30:20 PM
Thanks everyone for the great code :up:

Which code you mean?
Title: Re: [Done!] Join Us! form
Post by: akulion on November 03, 2006, 02:34:36 PM
:2funny: the code being discussed, i dont know - just thought id drop a compliment :2funny:
Title: Re: [Done!] Join Us! form
Post by: HaxXxoR on November 03, 2006, 03:15:15 PM
Quote from: londonhogfan on November 03, 2006, 05:26:25 AM
http://www.tinyportal.net/smf/index.php?topic=4560.msg40861#msg40861

works pretty good on my site.
http://www.the-rota.com/index.php?page=24 (at the bottom)

How did you do that in an article and then have it added to a post in the forums? I would like to do something like that as well.
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 03:21:44 PM
Quote from: HaxXxoR on November 03, 2006, 03:15:15 PMHow did you do that in an article and then have it added to a post in the forums? I would like to do something like that as well.

Here is how :) (http://www.tinyportal.net/smf/index.php?topic=9840.msg84957#msg84957)
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 07:29:09 PM
see what happens when its  younotbyyourself

great code, i will abuse it
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 07:54:00 PM
Being lazy I wanted that it be NotMeAtAll :2funny:
So if  londonhogfan noticed this thread and posted his links earlier I wouldn't do anything at all  :)
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 08:21:48 PM
wooo whooo glad he is lazier then u :P

basically its the same code, just with 1 click instead of two
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 08:29:13 PM
nope, My code sends email also.
And also it more extendable. For example I am changing it to also add a poll in the member only section of the forum
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 08:31:44 PM
add a poll for members only?
does this code work for guest ( the one u posted already )

edit

i'm worse at php then you are

but your instructiions are not very clear.

where do i put the values for things...
like where it post the topic, isee potentially where, but its not "clear" that is where it goes.

$msgOptions = array(
      'id' =>  0 ,

or

   $topicOptions = array(
      'id' => 0 ,

also stuff like
// Redirect to thank you page
   header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);
   
$thank_you_article_id = replace with number?
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 08:48:18 PM
i meant clan member as opposed to site registred users.

but yes the code allow to guest to submit the form
If you want to dissallow guest access put following cod at the beginning:


if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for  Clan membership.';
} else  {



also add closing bracet at the very end of the code



}


Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 08:53:43 PM
ok cause i am using this for guest :P

i have more question, but i need to edit the text first

I'll be back by nightfall (4pm now) :P  in no rush for a reply ty

EDIT*

how to hide MY email addy on the submit form
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 09:00:50 PM
Quote
ok cause i am using this for guest
I am not sure that guest posting will work -I didn't test it through

Quote
how to hide MY email addy on the submit form


Its not YOUR email but the person who logged in and filling the form.
If you are allow to guest to submit - it should be empty
But again - I am not sure about guests
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 09:08:27 PM
lol bummer that was my next question :P

maybe i could use the password protected board mod, and allow guest to post in it
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 09:11:16 PM
Quote from: Assistance on November 03, 2006, 09:08:27 PM
lol bummer that was my next question :P

Huh? which one?
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 09:16:28 PM
I am not sure that guest posting will work -I didn't test it through

^^ that one u answered


Edit*
guest can post in a non guest forum  :2funny:
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 03, 2006, 09:27:22 PM
//article to be redirected when form is submitted
$thank_you_article_id = '41';

doesnt seem to work, it drops the smf directory from the URL
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 03, 2006, 09:29:48 PM
hmm...

I have my forum installed in the root ...
I will try to find out how to correct it

*** Edit ***

As fast and dirty solution
change this:


header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);



To this:


header('Location: http://' . $_SERVER['HTTP_HOST'] .'/<forum_dir>/index.php?page=' . $thank_you_article_id);



Assuming that "<forum_dir>" is the directory for SMF


*****  Another edit ****

Or to this:


header('Location: http://' . $_SERVER['HTTP_HOST'] . $boarddir . '/index.php?page=' . $thank_you_article_id);



I haven't test it becaius as i said i have my forum installed in the root but it should work
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 08, 2006, 10:25:28 PM
neither works
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 08, 2006, 10:53:46 PM
did you tried to hardcode it? Like this:

headr('Location: http://yourdomain.com/forum/index.php?page=xx' );
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 09, 2006, 01:35:53 AM
header works, but not headr ;)

but yes hard coding works

ty
Title: Re: [Done!] Join Us! form
Post by: OzButcher on November 23, 2006, 08:06:37 AM
This is really cool!!! It works great thanks!  :up:

One question... I would like to put some text at the start of the application form... with rules etc. How can I insert text into the PHP Article without bringing up a error? I've tried:

<P> text blah blah </P>

and even

{echo <P> text blah blah </P> }

Title: Re: [Done!] Join Us! form
Post by: Assistance on November 23, 2006, 09:06:53 AM
echo "<p>text blah blah.</p>"
Title: Re: [Done!] Join Us! form
Post by: OzButcher on November 23, 2006, 09:12:05 AM
nope that doesnt work:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Program Files\xampp\htdocs\untforum\Sources\Load.php(1719) : eval()'d code(245) : eval()'d code on line 13
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 23, 2006, 09:19:04 AM
{
  echo '<p>text blah blah.</p>';
}
Title: Re: [Done!] Join Us! form
Post by: OzButcher on November 23, 2006, 09:32:21 AM
thats the one thanks!! :)

maybe one other thing. how can I add extra email addresses to this field:

[code]/ email address of recruitment admins
$email_address='myemail@iinet.net.au';


I tried

$email_address='myemail@iinet.net.au','email2.net.au','email3.net.au';[/code]

but must not be the correct code
Title: Re: [Done!] Join Us! form
Post by: Assistance on November 23, 2006, 09:40:14 AM
personally

I wouldnt even use that part
I would just allow those members you want to to recieve the info to see the board in which it is posted too.

also, i dont honestly know
Title: Re: [Done!] Join Us! form
Post by: OzButcher on November 23, 2006, 11:18:51 AM
I think its a good feature. Our clan has 4 main admins including myself so I think it would be handy if the other admins could also get a email to let them know who is signing up.

If anyone has the answer please let me know. This is a awesome mod!
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 23, 2006, 02:02:10 PM
Try



$email_address='myemail@iinet.net.au; email2.net.au; email3.net.au';



And thank you for compliments on my first ever php code :)
Title: Re: [Done!] Join Us! form
Post by: OzButcher on November 23, 2006, 02:21:00 PM
Thank YOU! Its awesome! (alright enough ass kissing hehe) ;)

No but really, its really good!!!! Its perfect! I'm sure many clans can benfit from this mod!
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 23, 2006, 02:23:54 PM
what game are you playing? maybe we can exchange more clan related scripts?
Title: Re: [Done!] Join Us! form
Post by: OzButcher on November 23, 2006, 02:31:09 PM
We play mostly Battlefield 2 and 2142 at the moment and we are compete in some Ladder matches. But we are currently discussing the possibility of bringing together various clans to form a bigger gaming community increasing the diversity of played games. Some members also play Rome Total war.

What games do you play?

Our site is at: unt.swisshut.com  :)

Mods on our site atm:

- Urs
- Member Awards v1.0.2
- Global Announcements
- Gallery lite

Using SMF 1.0.9 and 1.1 RC3-1 Security | Helios |TinyPortal v0.9.5
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 23, 2006, 02:35:40 PM
we are America's Army  addicts :)
visit us at http://wow-aao.net (http://wow-aao.net)
Title: Re: [Done!] Join Us! form
Post by: OzButcher on November 24, 2006, 06:43:55 AM
For some reason guests can still see the Form? I'm guessing the Echo tags with my html has affected this somehow?

could you please see if my code screwed up? :)

if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for  Clan membership.';
} else  {}

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');

{
  echo '<h2 align="center">Recruitment Application </h2><p align="center">Please read everything below very carefully and then complete the Application form on this page!<br />Completing this form does not guarantee Recruitment!</p><h3><span style="color: #009900"><strong>What is the Recruiting Process</strong></span> <br /></h3><p>The recruitment process can take up to 4 weeks. In these 4 weeks the following must happen:</p><p>1. Applicant must have installed/used our Ventrilo chat room  (see our <a href="http://unt.swisshut.com/index.php?page=6">General FAQ</a>).<br />2. Applicant must have at least 2 games (1 public - 1 practice) with an =UnT= Admin (Smegg, Nobby, Villain or OzButcher).<br />3. If a Admin likes what he sees (and Clan members report positive feedback on your performance) you will be recruited on a 2 week probationary period. If in these 2 weeks you fail to show a commitment to =UnT= or break any of our rules your application will be rejected.<br />4. Upon successful completion of your trial you will become a full =UnT= Clan Member and will be able to participate with us in ladder matches</p><h3><span style="color: #009900"><strong>Who are the Admins?</strong></span> <br /> </h3><p><a href="http://unt.swisshut.com/index.php?action=profile;u=16"> Smegg</a> <br /><a href="http://unt.swisshut.com/index.php?action=profile;u=12">Nobby</a> <br /><a href="http://unt.swisshut.com/index.php?action=profile;u=7">Villain</a> <br /><a href="http://unt.swisshut.com/index.php?action=profile;u=1">OzButcher</a> <br /></p><h3><span style="color: #009900"><strong>What are the requirments for joining?</strong></span></h3><p>The requirements for joining =UnT= are as follows:<br /><br />* An internet connection above 128k<br />* A full working copy of a multi player game ( eg: 2142 , BF2 etc ) patched to the latest version.<br />* A certain level of teamwork skills<br />* A certain level of combat skills<br />* Must be 18+ years of age </p><h3><span style="color: #009900"><strong>I know =UnT= members, does that increase my chances of getting in?</strong></span></h3><p>In most cases, yes<br /><br />If you have a reliable reference within the clan you have a greater chance of getting in. </p><h2><br /><font color="#339900">Recruitment Application Form:</font><br /></h2><p> </p><br />';
}


// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment admins
$email_address='didaswisshut@iinet.net.au; vclnobnuts@hotmail.com; brasso@optusnet.com.au; ulysses@dialtone.com.au';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;

//the id of the this article
$this_article_id = '28';

//article to be redirected when form is submitted
$thank_you_article_id = '26';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Hours played online:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Recruited by a UnT Member? ' . $_POST['aaotracker'] . '
UnT Members name:  ' . $_POST['aaotracker_name'] . '
Favourite KIT?  ' . $_POST['xfire'] . '
Able to attend Matches?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Do you posses any web design or other skill that  could be contributed to the clan: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Other Games Played:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />

[B]Real Name:[/B]  ' . $_POST['real_name'] . '
[B]Email address:[/B]  ' . $_POST['email'] . '
[B]In Game Nick:[/B]  ' . $_POST['aa_name'] . '
[B]Age:[/B] ' . $_POST['age'] . '
[B]Gender:[/B] ' . $_POST['gender'] . '
[B]Location:[/B] ' . $_POST['location'] . '
[B]Hours played online a week:[/B] ' . $_POST['honor'] . '
[B]Previous clan(s):[/B] ' . $_POST['prev_clans'] . '
[B]Banned from any sever:[/B] ' . $_POST['banned'] . '
[B]Recruited by a UnT Member?[/B] ' . $_POST['aaotracker'] . '
[B]UnT Members name:[/B] ' . $_POST['aaotracker_name'] . '
[B]Favourite KIT?[/B] ' . $_POST['xfire'] . '
[B]Able to attend Matches?:[/B] ' . $_POST['ts'] . '
[B]Have microphone/headset:[/B] ' . $_POST['mic'] . '
[B]Would like to help pay for a server?:[/B] ' . $_POST['pay'] . '
[B]Why do you want to join our clan?[/B] ' . $_POST['why'] . '
[B]Other Games Played:[/B] ' . $_POST['habbits'] . '
[B]Other information:[/B] ' . $_POST['other']. '';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* In-Game Nick:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Hours Spent playing online a week:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Were you recruited by a UnT Member?</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">UnT Member name:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What is your favourite Kit</TD>
<TD><INPUT id="xfire" name="xfire" type="text" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire']; 
echo '" /></TD>
       </TR>
<TR class ="windowbg2">
<TD width = "200px">Will you be able to attend practice and matches?</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
                                                <OPTION value="I will try my best">I will try my best</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join =UNT=?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What Other games to you play?:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
                       <TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>


also... adding extra email addresses like you showed me in the previous page wont work. If I try that method it wont send to any email address, instead sends me a error email.
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 24, 2006, 02:12:47 PM
Hi,

You closed else clause too early when checking for guest...

instead of



if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for  Clan membership.';
} else  {}

..... <REST OF THE CODE >


Should be



if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for  Clan membership.';
} else  { // remove closing bracket
..... <REST OF THE CODE >

} // Closing at the very end of the code





Title: Re: [Done!] Join Us! form
Post by: samson on November 26, 2006, 03:43:05 PM
Cant wait to try this mod I love the 1 click submit

Quick question I see you have a pop up that says you must be registered Is there a way to make check to see if the person has been registered for a certain amount of time?

example

sorry you must be registered for at least 30 days to fill out an application.

thanks in advance
Title: Re: [Done!] Join Us! form
Post by: hsdk on November 27, 2006, 12:18:04 AM
I tried this and it`s superb! But i need help with one thing.

I want to use data for two fields for my subject. i do this by using this:

'subject' => . $_POST['place'] . $_POST['date'],

but i need a space between them? If i use it like this, i wil show up like this : "placedate", i need "place date" :)

Hope someone could tell me how :)


A

Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 27, 2006, 02:01:54 PM
hsdk, 

'subject' => . $_POST['place'] . ' ' . $_POST['date'], should do the trick :)
Title: Re: [Done!] Join Us! form
Post by: mebymyself on November 27, 2006, 03:41:56 PM
samson,

I believe you can use folowing function to calculate how many days between given dates but I realy cannot find registration date neither in $context nor in $user_info arrays :(
You may need to query database for it

and here is the function:


function days_between($fyear, $fmonth, $fday, $tyear, $tmonth, $tday)
{
  return abs((mktime ( 0, 0, 0, $fmonth, $fday, $fyear) - mktime ( 0, 0, 0, $tmonth, $tday, $tyear))/(60*60*24));
}




Title: Re: [Done!] Join Us! form
Post by: samson on November 27, 2006, 09:22:29 PM
QuoteI believe you can use folowing function to calculate how many days between given dates but I realy cannot find registration date neither in $context nor in $user_info arrays
You may need to query database for it

and here is the function:

thanks but That would be as easy for me as building a nuclear bomb  :2funny:

Me finds somthing different to try  ;)

I love you form though it works great

Title: Re: [Done!] Join Us! form
Post by: mfKG on November 30, 2006, 05:19:05 AM
THX to mebymyself for sharing this,...i also learnt something 'bout forms ;)...GREAT,..
but i suggest to change the <table><tr><td> for makeing a post to [table][tr][td]. Workt with <>, but was not formatet right and try after edit that post, hihi....
Title: Re: [Done!] Join Us! form
Post by: mfKG on December 02, 2006, 09:32:36 PM
need help, plz ;) :

<TEXTAREA class="inp_txt" id="habbits" name="habbits" rows="4" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits']; echo '" ></' . 'TEXTAREA>


doesnt work (value doesnt work 4 textareas),...

so i changed to
<TEXTAREA class="inp_txt" id="habbits" name="habbits" rows="4">';
if (isset($_POST['habbits'])) echo $_POST['habbits']; echo </' . 'TEXTAREA>


but this produce en error in the artice,...very confusing, dont know why ;( (drops the code after "echo'"...

(btw: why is there "' . '"</' . 'TEXTAREA>? sry, im a very php newbie;))

tHX 4 help


edit: ok, this must be an TP Issue.....my code is correct,...tested it in a customaction (so it saves also the code in the textareas, with value its not working;)),....k...then i will make it with action,...looks anyway nicer ;) (?action=joinus)....
Title: Re: [Done!] Join Us! form
Post by: OzButcher on December 05, 2006, 01:57:29 AM
I thought of a extra feature... But I'm not sure how easy it is to add. :)

Our clan is getting 5-7 new applications a day and we are finding it a bit tiresome having to manually send a comprehensive "New Recruit" email which includes information on how to setup our in-game communications, rules, recruiting process etc.

Is it possible to automatically send a pre-formatted letter to new applicants after they hit the Send Application button?
Title: Re: [Done!] Join Us! form
Post by: junkenstein on December 05, 2006, 01:51:57 PM
I just wanted to say thank you for this great script!
It works really well on my site, but i have 1 little problem.
Every time a new user submits a new application, then on the forum there will  be alot of spaces before the input text.
Does anyone have any idea where to change that?
Thanx in advance :)
Title: Re: [Done!] Join Us! form
Post by: hsdk on December 05, 2006, 02:33:14 PM
Quote from: junkenstein on December 05, 2006, 01:51:57 PM
I just wanted to say thank you for this great script!
It works really well on my site, but i have 1 little problem.
Every time a new user submits a new application, then on the forum there will  be alot of spaces before the input text.
Does anyone have any idea where to change that?
Thanx in advance :)

reformat the output, and remove the table tags.
Title: Re: [Done!] Join Us! form
Post by: junkenstein on December 05, 2006, 03:09:46 PM
Thanks for the answer but i have no idea what you are talking about lol
Here's a copy of my phpfile, it would be really sweet if you could give me any tips :)

if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for The Fellowship Elites.';
} else  { // remove closing bracket


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of reqruitment staf member
$email_address='xxx';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2;

//the id of the this article
$this_article_id = '12';

//article to be redirected when form is submitted
$thank_you_article_id = '13';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';

// Check for an location
if (empty($_POST['location']) ){
$enroll_errors[] = 'You forgot to enter your location.';
}
   
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}

// Check for an class
if (empty($_POST['class']) ){
$enroll_errors[] = 'You forgot to enter your class.';
}

// Check for an race
if (empty($_POST['race']) ){
$enroll_errors[] = 'You forgot to enter your race.';
}

// Check for an level
if (empty($_POST['level']) ){
$enroll_errors[] = 'You forgot to enter your level.';
}

// Check for an professions
if (empty($_POST['professions']) ){
$enroll_errors[] = 'You forgot to enter your professions.';
}

// Check for an attunements
if (empty($_POST['attunements']) ){
$enroll_errors[] = 'You forgot to enter your attunements.';
}

// Check for an playtime
if (empty($_POST['playtime']) ){
$enroll_errors[] = 'You forgot to enter your playtimes.';
}

// Check for an talents
if (empty($_POST['talents']) ){
$enroll_errors[] = 'You forgot to enter your talents.';
}

// Check for an ventrilo
if (empty($_POST['ventrilo']) ){
$enroll_errors[] = 'You forgot to enter your ventrilo question.';
}

// Check for an pvp
if (empty($_POST['pvp']) ){
$enroll_errors[] = 'You forgot to enter your pvp.';
}

// Check for an contribution
if (empty($_POST['contribution']) ){
$enroll_errors[] = 'You forgot to enter your contribution question.';
}

// Check for an why
if (empty($_POST['why']) ){
$enroll_errors[] = 'You forgot to enter why you want to join us.';
}                   
    }

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Name: ' . $_POST['name'] . '
Email address: ' . $_POST['email'] . '
Location: ' . $_POST['location'] . '
Gender: ' . $_POST['gender'] . '
Age: ' . $_POST['age'] . '
Class: ' . $_POST['class'] . '
Race: ' . $_POST['race'] . '
Level: ' . $_POST['level'] . '
Professions: ' . $_POST['professions'] . '
Attunements: ' . $_POST['attunements'] . '
Playtime: ' . $_POST['playtime'] . '
Talents: ' . $_POST['talents'] . '
Ventrilo: ' . $_POST['ventrilo'] . '
PvP: ' . $_POST['pvp'] . '
CTprofile: ' . $_POST['ctprofile'] . '
Contribution: ' . $_POST['contribution'] . '
Why do you want to join our guild? ' . $_POST['why'] . '
Other information: ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Gender:<td></td><td>  ' . $_POST['gender'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Class:<td></td><td> ' . $_POST['class'] . '</td></tr>
<tr><td>Race:<td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>Level:<td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Professions:<td></td><td>  ' . $_POST['professions'] . '</td></tr>
<tr><td>Attunements:<td></td><td>  ' . $_POST['attunements'] . '</td></tr>
<tr><td>Playtime:<td></td><td>  ' . $_POST['playtime'] . '</td></tr>
<tr><td>Talents:<td></td><td>  ' . $_POST['talents'] . '</td></tr>
<tr><td>Ventrilo:<td></td><td>  ' . $_POST['ventrilo'] . '</td></tr>
<tr><td>PvP:<td></td><td>  ' . $_POST['pvp'] . '</td></tr>
<tr><td>CTprofile:<td></td><td>  ' . $_POST['ctprofile'] . '</td></tr>
<tr><td>Contribution:<td></td><td>  ' . $_POST['contribution'] . '</td></tr>
<tr><td>Why do you wanna join this guild:<td></td><td>  ' . $_POST['why'] . '</td></tr>
<tr><td>Other information:<td></td><td>  ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'] . ' ' . $_POST['level'] . ' ' . $_POST['class'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">Character Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Male">Male</OPTION>
<OPTION value="Female">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Class:</TD>
                                </TD>
<TD><SELECT id="class" name= "class" style="WIDTH: 152px" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Druid">Druid</OPTION>
<OPTION value="Hunter">Hunter</OPTION>
<OPTION value="Mage">Mage</OPTION>
<OPTION value="Paladin">Paladin</OPTION>
<OPTION value="Priest">Priest</OPTION>
<OPTION value="Rogue">Rogue</OPTION>
<OPTION value="Warlock">Warlock</OPTION>
<OPTION value="Warrior">Warrior</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Race:</TD>
                                </TD>
<TD><SELECT id="race" name= "race" style="WIDTH: 152px" value ="';
if (isset($_POST['race'])) echo $_POST['race'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Dwarf">Dwarf</OPTION>
<OPTION value="Human">Human</OPTION>
<OPTION value="Gnome">Gnome</OPTION>
<OPTION value="Night Elf">Night Elf</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Level:</TD>
<TD><INPUT id ="level" name ="level" type="text" value ="';
if (isset($_POST['level'])) echo $_POST['level'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What are your professions?</TD>
<TD><INPUT id ="professions" name ="professions" type="text" value ="';
if (isset($_POST['professions'])) echo $_POST['professions'];   
echo '"  /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Which attunements do you have?</TD>
<TD><INPUT id="attunements" name="attunements" type="text" value ="';
if (isset($_POST['attunements'])) echo $_POST['attunements']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">At which times do you play daily?</TD>
<TD><INPUT id="playime" name="playtime" type="text" value ="';
if (isset($_POST['playtime'])) echo $_POST['playtime']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What is your current talentbuild?</TD>
<TD><INPUT id="talents" name="talents" type="text" value ="';
if (isset($_POST['talents'])) echo $_POST['talents'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ventrilo" name="ventrilo" style="WIDTH: 160px" value ="';
if (isset($_POST['ventrilo'])) echo $_POST['ventrilo'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you PvP often and is this very important to you?</TD>
<TD><INPUT id="pvp" name="pvp" type="text" value ="';
if (isset($_POST['pvp'])) echo $_POST['pvp'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">If you have a CTprofile, then please link it here:</TD>
<TD><INPUT id="ctprofile" name="ctprofile" type="text" value ="';
if (isset($_POST['ctprofile'])) echo $_POST['ctprofile'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">How do you think you can contribute to the guild?</TD>
<TD><TEXTAREA id="contribution" name ="contribution" rows="4" cols="40" value ="';
if (isset($_POST['contribution'])) echo $_POST['contribution'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Why do you wanna join us?
</TD>
<TD><TEXTAREA id="why" name = "why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];
echo '" ></' . 'TEXTAREA></TD> </TR>

<TR class ="windowbg2">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
} // Closing at the very end of the code
Title: Re: [Done!] Join Us! form
Post by: OzButcher on December 05, 2006, 03:23:17 PM
I had this same problem... I took off all the table tags in the bit which submits the fields to the forum. You can actually improve how it will look in the forum using the bold tags.... Sample from my script:

[B]Real Name:[/B]  ' . $_POST['real_name'] . '
[B]Email address:[/B]  ' . $_POST['email'] . '
[B]In-Game Nick:[/B]  ' . $_POST['aa_name'] . '
[B]Age:[/B] ' . $_POST['age'] . '
[B]Gender:[/B] ' . $_POST['gender'] . '
[B]Location:[/B] ' . $_POST['location'] . '


Your current layout:
<table>
<tr><td>Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Gender:<td></td><td>  ' . $_POST['gender'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Class:<td></td><td> ' . $_POST['class'] . '</td></tr>
<tr><td>Race:<td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>Level:<td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Professions:<td></td><td>  ' . $_POST['professions'] . '</td></tr>
<tr><td>Attunements:<td></td><td>  ' . $_POST['attunements'] . '</td></tr>
<tr><td>Playtime:<td></td><td>  ' . $_POST['playtime'] . '</td></tr>
<tr><td>Talents:<td></td><td>  ' . $_POST['talents'] . '</td></tr>
<tr><td>Ventrilo:<td></td><td>  ' . $_POST['ventrilo'] . '</td></tr>
<tr><td>PvP:<td></td><td>  ' . $_POST['pvp'] . '</td></tr>
<tr><td>CTprofile:<td></td><td>  ' . $_POST['ctprofile'] . '</td></tr>
<tr><td>Contribution:<td></td><td>  ' . $_POST['contribution'] . '</td></tr>
<tr><td>Why do you wanna join this guild:<td></td><td>  ' . $_POST['why'] . '</td></tr>
<tr><td>Other information:<td></td><td>  ' . $_POST['other']. '</td></tr>
</table>';


I would maybe change to this:


Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Location:  ' . $_POST['location'] . '
Gender:  ' . $_POST['gender'] . '
Age:  ' . $_POST['age'] . '
Class: ' . $_POST['class'] . '
Race: ' . $_POST['race'] . '
Level: ' . $_POST['level'] . '
Professions:  ' . $_POST['professions'] . '
Attunements:  ' . $_POST['attunements'] . '
Playtime:  ' . $_POST['playtime'] . '
Talents:  ' . $_POST['talents'] . '
Ventrilo:  ' . $_POST['ventrilo'] . '
PvP:  ' . $_POST['pvp'] . '
CTprofile:  ' . $_POST['ctprofile'] . '
Contribution:  ' . $_POST['contribution'] . '
Why do you wanna join this guild:  ' . $_POST['why'] . '
Other information:  ' . $_POST['other']. ';




Title: Re: [Done!] Join Us! form
Post by: junkenstein on December 05, 2006, 03:45:23 PM
That did the trick!
Thank you so much!
Title: Re: [Done!] Join Us! form
Post by: OzButcher on December 05, 2006, 03:54:24 PM
No problem :)

Looking through your code I actually realised the form can be redirected to another article which is an other alternative solution the my last request for a custom email feature :)
Title: Re: [Done!] Join Us! form
Post by: Balrost on December 21, 2006, 05:25:30 PM
This is an awesome script.  Thanx for your hard work.

When I run the script as you have it it works fine.  When I change the way the data is posted and emailed it works fine.  BUT...

When I go in and try to customise the form, basicly I want to remove some of the questions such as gender, I get an error.

Parse error: parse error, unexpected T_STRING in /home/vongr2/public_html/hg/Sources/Load.php(1733) : eval()'d code(231) : eval()'d code on line 81

I am removing <TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>


I was ass-u-me ing that was all I hade to do.  I just need to remove some of the questions that dont pertain to my needs.

Please help. 

Thanx in advance.
Title: Re: [Done!] Join Us! form
Post by: Balrost on December 21, 2006, 05:44:48 PM
I figured it out.  It wasn't in the removal of code.  I have put a ' in the wrong dang spot way back up in the email section.

Sure wish I had a clue what I was doing. LOL

Thanx for your time.
Title: Re: [Done!] Join Us! form
Post by: dapoppet on January 04, 2007, 12:34:28 AM
I love this script.  I had it up and working and well...i ended up trashing everything to start with a fresh install and I didn't save my form.

I am having problems with it posting to the forum.

Current code:

// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address=\'xxx\';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=3;

//the id of the this article
$this_article_id = '11';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


This actually posts to the forum, but it does not redirect to the thank you article.  I get a 404 error for index.php?page=11.

I change the this_article_id = '7'; and it redirects to the correct article, but does not post.  Any idea's on how to fix this?

Thanks!
Title: Re: [Done!] Join Us! form
Post by: Assistance on January 04, 2007, 06:53:32 AM
http://www.tinyportal.net/index.php?topic=9840.msg85095#msg85095
pg.  6

:up: read my post and the next few down :down:
Title: Re: [Done!] Join Us! form
Post by: mfKG on January 04, 2007, 09:11:16 PM
Quote from: dapoppet on January 04, 2007, 12:34:28 AM
This actually posts to the forum, but it does not redirect to the thank you article.Ã,  I get a 404 error for index.php?page=11.

i've manged this on another way:
i made anyway a costum action for the formular with a template.

in the code i added after:
if ($enable_post)
Ã,  Ã,  Ã,  Ã,  createPost($msgOptions, $topicOptions, $posterOptions);

this:

echo
'
<br />
<p align="center">
BlaBlaBla, '.$_POST['name'].'.
<br />
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, Ã,  BlaBlaBla
<br />
THX u 4 filling out the apllication BlaBla
</p>
';
RETURN;

So it's "all in one" ;)
Works nice for me

i needed to this that way, coz the method with remember the <textarea> input dont works that way like the <input> (with the value, needed to do else). after i corrected this, the article "messed up up" then. postet this time ago....
but so it works like a charme ;)
Title: Re: [Done!] Join Us! form
Post by: dapoppet on January 05, 2007, 12:53:02 PM
Thanks so much for the replies.  I got it to work!
Title: Re: [Done!] Join Us! form
Post by: mfKG on January 06, 2007, 02:19:05 PM
does perhaps someone know, how i get the Post ID of the new created Post?
coz i wanna redirect after the "Thx u page" to his application-post.
Title: Re: [Done!] Join Us! form
Post by: Ryushi32 on January 24, 2007, 12:37:22 AM
I was wondering how to create a poll in the post with the application
Title: Re: [Done!] Join Us! form
Post by: iowamf on February 05, 2007, 08:38:40 AM
I was interested in the code that posts the output of a PHP form into the forum - works! Thanks ...

One issue -> I changed the $board_id to a highly restricted board and found that this script could post into that board (even though the user filling out the form cannot access that board).  I don't consider this a bug - I think it is a feature - but it did surprise me that this would work. 

If someone cares to explain why this script allows a user to post into a board they do not have access to - I would love to hear the answer.

PS - even a guest can post to restricted boards with this form.
Title: Re: [Done!] Join Us! form
Post by: iowamf on February 05, 2007, 08:44:16 AM
btw, the script assumes SMF is installed in the root directory.
If you installed SMF in a subdirectory, you have to change a couple lines of code that reference the path.
Title: Re: [Done!] Join Us! form
Post by: mfKG on February 05, 2007, 11:40:26 AM
Quote from: iowamf on February 05, 2007, 08:38:40 AM
One issue -> I changed the $board_id to a highly restricted board and found that this script could post into that board (even though the user filling out the form cannot access that board).  I don't consider this a bug - I think it is a feature - but it did surprise me that this would work. 

thats simple, isnt it.....u take the function "createPost", which creates just the Post. But u dont check if the user have the right to Post in this Board(s) ;) ^^ that u need to do before, if u want....
Title: Re: [Done!] Join Us! form
Post by: alan s on February 11, 2007, 06:55:33 PM
Oh god...........why does everything go wrong for me! lol

I get this error

Fatal error: Call to undefined function: createpost() in /home/alan/public_html/beboskinzone.com/forum/Sources/Load.php(1733) : eval()'d code(231) : eval()'d code on line 126

using this code





//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=5;

//the id of the this article
$this_article_id = '7';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter the Authors name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your skin theme.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter the Skin name.';
}

if (empty($enroll_errors)) { //Everything seems to be OK

        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Skin] ' . $context['aa_name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);

if ($enable_post)
        createPost($msgOptions, $topicOptions, $posterOptions);
         echo
'
<br />
<p align="center">
BlaBlaBla, '.$_POST['name'].'.
<br />
                       BlaBlaBla
<br />
THX u 4 filling out the apllication BlaBla
</p>
';
RETURN;
// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">Authors Name :</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Skin Theme :</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Skin Name :</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">ScreenShot :</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Download :</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Any other information you want to add about the skin? :</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';




Line 126 = createPost($msgOptions, $topicOptions, $posterOptions);

Any ideas?
Title: Re: [Done!] Join Us! form
Post by: jacortina on February 11, 2007, 07:06:14 PM
Try a require_once for Sources/Subs-Post.php perhaps (that's where that function is defined)?
Title: Re: [Done!] Join Us! form
Post by: alan s on February 11, 2007, 07:08:42 PM
Er could you explain that to me again please? , Even after a year im still completely clueless with php functions lol


- Alan S
Title: Re: [Done!] Join Us! form
Post by: jacortina on February 11, 2007, 07:17:24 PM
That function is defined in the file Subs-Post.php (in the Sources directory).

It may be that depending on the processing which precedes use of this form, it MAY load up that file and the function definitions which it contains (which explains why others up-thread say they have it working).

By using the require_once() PHP command, you 'include' the file (the function definitions), but only if it hasn't already been included.

So, up at the top of the code (the configuration section) try adding the lines:
global $sourcedir;
require_once($sourcedir . '/Subs-Post.php');
Title: Re: [Done!] Join Us! form
Post by: alan s on February 11, 2007, 07:22:59 PM
Thanks! It works!
Title: Re: [Done!] Join Us! form
Post by: DOOM666 on May 03, 2007, 07:25:40 AM
i tyred this code for gust but it doesn't work, they still can post

Quoteif ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registered on the site in order to apply for The Fellowship Elites.';
} else  { // remove closing bracket


my code
if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for  Clan membership.';
}

else

{


}

it will say what is says in the code but the can see and fill out the form and submit it.




QuoteQuick question I see you have a pop up that says you must be registered

how did you do that on your web site that is cool


and thank you in advance
Title: Re: [Done!] Join Us! form
Post by: tribalost on May 05, 2007, 10:20:07 PM
im getting a Parse error: syntax error, unexpected T_STRING in /home/trivu/public_html/Sources/Load.php(1842) : eval()'d code(209) : eval()'d code on line 1

help :(

here's my application form:
                                                                       FireFox installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Moderating Experience?  ' . $_POST['why'] . '
Surfing habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Forum Nick:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Position In Mind: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Why We Should Pick You: <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with Yahoo!? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>Yahoo! ID:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with MSN? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>MSN Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>FireFox installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Surfing habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current Forum Nick:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Position In Mind:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Why We Should Pick You</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registered with Yahoo!?</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Yahoo! ID:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with MSN?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">MSN Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have FireFox installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Moderating Experience?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your surfing habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: mfKG on May 06, 2007, 06:54:06 PM

echo'          
FireFox installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '


dunno,....but think at the beginning theres missing atleast "echo'" ;) (and then close this also....)
Title: Re: [Done!] Join Us! form
Post by: tribalost on May 06, 2007, 11:30:44 PM
i just realized that i erased the whole head part -.-'''
tnx for the help anyways :)
Title: Re: [Done!] Join Us! form
Post by: Phamon on May 30, 2007, 06:21:08 PM
First off a HUGE thank you is due... finally got this up and running and my guild loves this addition to our forums.

I am not using the e-mail feature yet(and probably wont) and am only having one slight issue with the forum post results, a large gap between the initial text and the "table" as you can see in the attached image. I have modified the code several times to try to fix this but am finding as a work around that simply opening the new posts to modify them and hitting submit without changing anything does the trick but would love it if it could be fixed where it wasn't necessary

Here is the code I am using... any help would be greatly appreciated
global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of recruitment staf member
$email_address='recruitement@vgfoundation.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=3;

//the id of the this article
$this_article_id = '19';

//article to be redirected when form is submitted
$thank_you_article_id = '20';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}
// Check for Gender
if (empty($_POST['gender']) ){
$enroll_errors[] = 'You forgot to enter your gender.';
}
// Check for an In-Game name
if (empty($_POST['vg_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Name.';
}
// Check for Character Race
if (empty($_POST['race']) ){
$enroll_errors[] = 'You forgot to enter your Characters Race.';
}
// Check for Adventure Class
if (empty($_POST['adv_class']) ){
$enroll_errors[] = 'You forgot to enter your Adventure Class.';
}
// Check for Adventure Level
if (empty($_POST['adv_lvl']) ){
$enroll_errors[] = 'You forgot to enter your Adventure Level.';
}
// Check for Crafting Class
if (empty($_POST['craft_class']) ){
$enroll_errors[] = 'You forgot to enter your crafting class.';
}
// Check for Crafting Level
if (empty($_POST['craft_lvl']) ){
$enroll_errors[] = 'You forgot to enter your Crafting Level.';
}
// Check for Diplomacy Level
if (empty($_POST['diplo_lvl']) ){
$enroll_errors[] = 'You forgot to enter your Diplomacy Level.';
}
// Check for Previous Guilds
if (empty($_POST['prev_guild']) ){
$enroll_errors[] = 'You forgot to enter your Previous guilds... enter none if none.';
}
// Check for Goals
if (empty($_POST['goals']) ){
$enroll_errors[] = 'You forgot to enter your In-Game goals.';
}
// Check for Known members
if (empty($_POST['known_members']) ){
$enroll_errors[] = 'You forgot to enter the names of the guildies you have met... enter none if you havent had the pleasure.';
}
// Check for looking to Raid?
if (empty($_POST['raid']) ){
$enroll_errors[] = 'You forgot to enter if you are interested in Raiding.';
}
// Check for Ventrillo
if (empty($_POST['vent']) ){
$enroll_errors[] = 'You forgot to enter your willingness to install Ventrillo.';
}
// Check for a Mic
if (empty($_POST['mic']) ){
$enroll_errors[] = 'You forgot to enter if you have a mic or not.';
}
// Check for Playtimes
if (empty($_POST['playtimes']) ){
$enroll_errors[] = 'You forgot to enter your play times.';
}
// Check for Team-oriented
if (empty($_POST['team']) ){
$enroll_errors[] = 'You forgot to enter if you are team oriented.';
}
// Check for Expectations
if (empty($_POST['gimme']) ){
$enroll_errors[] = 'You forgot to enter your guild expectations.';
}
// Check for Leadership needs
if (empty($_POST['leader']) ){
$enroll_errors[] = 'You forgot to enter your Leadership expectations.';
}
// Check for where they heard of us
if (empty($_POST['where']) ){
$enroll_errors[] = 'You forgot to enter where you heard about us.';
}
// Check for Other
if (empty($_POST['other']) ){
$enroll_errors[] = 'You forgot to enter a little more about yourself.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Current Game Name:  ' . $_POST['vg_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'].'[hr][html]<table>
<tr><td>1.) RL Name(optional):<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>2.) RL Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>3.) RL Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>4.) Current Game Name:<td></td><td>  ' . $_POST['vg_name'] . '</td></tr>
<tr><td>5.) Player Race: <td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>6.) Adventuring Class: <td></td><td> ' . $_POST['adv_class'] . '</td></tr>
<tr><td>7.) Adventuring Level: <td></td><td> ' . $_POST['adv_lvl'] . '</td></tr>
<tr><td>8.) Crafting Class: <td></td><td> ' . $_POST['craft_class'] . '</td></tr>
<tr><td>9.) Crafting Level: <td></td><td> ' . $_POST['craft_lvl'] . '</td></tr>
<tr><td>10.) Diplomacy Level: <td></td><td> ' . $_POST['diplo_lvl'] . '</td></tr>
<tr><td>11.) What Games & Guilds have you been apart of in the past year?: <td></td><td> ' . $_POST['prev_guild'] . '</td></tr>
<tr><td>12.) What are your Future Goals for yourself in Vanguard?: <td></td><td> ' . $_POST['goals'] . '</td></tr>
<tr><td>13.) Do you know any Foundation members? If so who and what was your experience with them. <td></td><td>' . $_POST['known_members'] . '</td></tr>
<tr><td>14.) Has one of them agreed to sponsor you?:  <td></td><td>' . $_POST['sponsor'] . '</td></tr>
<tr><td>15.) What makes you a good fit for Foundation? <td></td><td> ' . $_POST['good_fit'] . '</td></tr>
<tr><td>16.) Are you looking to Raid? Kill the Big Stuff?: <td></td><td> ' . $_POST['raid'] . '</td></tr>
<tr><td>17.) Ventrilo installed or willing to install?: <td></td><td> ' . $_POST['vent'] . '</td></tr>
<tr><td>18.) Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>19.) What are your game play times and frequency of play? Time Zone?:<td></td><td> ' . $_POST['playtimes'] . '</td></tr>
<tr><td>20.) We are looking for team oriented people, do you fit this criteria?: <td></td><td> ' . $_POST['team'] . '</td></tr>
<tr><td>21.) What do you expect to get out of Foundation if selected to be a member?: <td></td><td> ' . $_POST['gimme'] . '</td></tr>
<tr><td>22.) What do you feel are the most important aspects of a leader?: <td></td><td> ' . $_POST['leader'] . '</td></tr>
<tr><td>22.) Where did you hear about us?<td></td><td> ' . $_POST['where'] . '</td></tr>
<tr><td>23.) Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>[/html]';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://www.vgfoundation.com/forums/index.php?page=20');

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">Your real Name(optional):</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">You have read and understand our guilds Tenets as described <A href="http://www.vgfoundation.com/forums/index.php?topic=2.0">here</A>.</TD>
<TD><SELECT id="tenets" name="tenets" style="WIDTH: 160px" value ="';
if (isset($_POST['tenets'])) echo $_POST['tenets'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">You have read and understand our guilds recruitment process as described <A href="http://www.vgfoundation.com/forums/index.php?topic=172.0">here</A>.</TD>
<TD><SELECT id="recruitment" name="recruitment" style="WIDTH: 160px" value ="';
if (isset($_POST['recruitment'])) echo $_POST['recruitment'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 160px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Current Main Characters Name:</TD>
<TD><INPUT id="aa_name" name="vg_name" type="text" value ="';
if (isset($_POST['vg_name'])) echo $_POST['vg_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Player Race:</TD>
<TD><SELECT id = "race" name = "race" style="WIDTH: 160px" value ="';
if (isset($_POST['race'])) echo $_POST['race'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Dwarf">Dwarf</OPTION>
<OPTION value="Thestran Human">Thestran Human</OPTION>
<OPTION value="Halfling">Halfling</OPTION>
<OPTION value="High Elf">High Elf</OPTION>
<OPTION value="Lesser Giant">Lesser Giant</OPTION>
<OPTION value="Varanjar Barbarian">Varanjar Barbarian</OPTION>
<OPTION value="Vulmane">Vulmane</OPTION>
<OPTION value="Qualian Human">Qualian Human</OPTION>
<OPTION value="Gnome">Gnome</OPTION>
<OPTION value="Dark Elf">Dark Elf</OPTION>
<OPTION value="Varanthari Barbarian">Varanthari Barbarian</OPTION>
<OPTION value="Kurashasa">Kurashasa</OPTION>
<OPTION value="Kojani Human">Kojani Human</OPTION>
<OPTION value="Goblin">Goblin</OPTION>
<OPTION value="Half Elf">Half Elf</OPTION>
<OPTION value="Wood Elf">Wood Elf</OPTION>
<OPTION value="Orc">Orc</OPTION>
<OPTION value="Raki">Raki</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Adventure Class:</TD>
<TD><SELECT id = "adv_class" name = "adv_class" style="WIDTH: 160px" value ="';
if (isset($_POST['adv_class'])) echo $_POST['adv_class'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="DRK">Dreadknight</OPTION>
<OPTION value="WAR">Warrior</OPTION>
<OPTION value="PAL">Palladin</OPTION>
<OPTION value="ROG">Rogue</OPTION>
<OPTION value="BRD">Bard</OPTION>
<OPTION value="RNG">Ranger</OPTION>
<OPTION value="MNK">Monk</OPTION>
<OPTION value="PSI">Psionicist</OPTION>
<OPTION value="NEC">Necromancer</OPTION>
<OPTION value="SOR">Sorceror</OPTION>
<OPTION value="DRU">Druid</OPTION>
<OPTION value="CLR">Cleric</OPTION>
<OPTION value="BMG">Blood Mage</OPTION>
<OPTION value="DSC">Disciple</OPTION>
<OPTION value="SHM">Shaman</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Adventure Level:</TD>
<TD><INPUT id="adv_lvl" name="adv_lvl" type="text" value ="';
if (isset($_POST['adv_lvl'])) echo $_POST['adv_lvl'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Crafting Class:</TD>
<TD><SELECT id = "craft_class" name = "craft_class" style="WIDTH: 160px" value ="';
if (isset($_POST['craft_class'])) echo $_POST['craft_class'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Undecided">Undecided</OPTION>
<OPTION value="Artisan">Artisan</OPTION>
<OPTION value="Minerologist">Minerologist</OPTION>
<OPTION value="Carpenter">Carpenter</OPTION>
<OPTION value="Blacksmith">Blacksmith</OPTION>
<OPTION value="Armorsmith">Armorsmith</OPTION>
<OPTION value="Weaponsmith">Weaponsmith</OPTION>
<OPTION value="Outfitter">Outfitter</OPTION>
<OPTION value="Leatherworker">Leatherworker</OPTION>
<OPTION value="Tailor">Tailor</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Crafting Level:</TD>
<TD><INPUT id="craft_lvl" name="craft_lvl" type="text" value ="';
if (isset($_POST['craft_lvl'])) echo $_POST['craft_lvl'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Diplomacy Level:</TD>
<TD><INPUT id="diplo_lvl" name="diplo_lvl" type="text" value ="';
if (isset($_POST['diplo_lvl'])) echo $_POST['diplo_lvl'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What Games & Guilds have you been a part of in the last year :</TD>
<TD><TEXTAREA id="prev_guild" name="prev_guild" rows="5" cols="40" value ="';
if (isset($_POST['prev_guild'])) echo $_POST['prev_guild'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What are your future goals for yourself in Vanguard:</TD>
<TD><TEXTAREA id ="goals" name ="goals" rows="5" cols="40"  value ="';
if (isset($_POST['goals'])) echo $_POST['goals'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you know any current Foundation members? If so, please describe your experience with them:</TD>
<TD><TEXTAREA id ="known_members" name ="known_members" rows="5" cols="40"  value ="';
if (isset($_POST['known_members'])) echo $_POST['known_members'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Have they already offered to sponsor you?:</TD>
<TD><TEXTAREA id ="sponsor" name ="sponsor" rows="1" cols="40"  value ="';
if (isset($_POST['sponsor'])) echo $_POST['sponsor'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What makes you a good fit for Foundation?:</TD>
<TD><TEXTAREA id ="good_fit" name ="good_fit" rows="5" cols="40"  value ="';
if (isset($_POST['good_fit'])) echo $_POST['good_fit'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Are you looking to Raid? Kill the big stuff?</TD>
<TD><SELECT id="raid" name="raid" style="WIDTH: 160px" value ="';
if (isset($_POST['raid'])) echo $_POST['raid'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Ventrillo installed or willing to install?</TD>
<TD><SELECT id="vent" name="vent" style="WIDTH: 160px" value ="';
if (isset($_POST['vent'])) echo $_POST['vent'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have a microphone/headset?:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What are your Game playtimes and frequency of play?:</TD>
<TD><TEXTAREA id ="playtimes" name ="playtimes" rows="5" cols="40"  value ="';
if (isset($_POST['playtimes'])) echo $_POST['playtimes'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">We are looking for team oriented people... do you fit this description:</TD>
<TD><SELECT id="team" name="team" style="WIDTH: 160px" value ="';
if (isset($_POST['team'])) echo $_POST['team'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What do you expect out of Foundation if selected to become a member?:</TD>
<TD><TEXTAREA id ="gimme" name ="gimme" rows="5" cols="40"  value ="';
if (isset($_POST['gimme'])) echo $_POST['gimme'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What do you feel are the most important aspects of a leader?:</TD>
<TD><TEXTAREA id ="leader" name ="leader" rows="5" cols="40"  value ="';
if (isset($_POST['leader'])) echo $_POST['leader'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Where did you hear about us?:</TD>
<TD><INPUT id="where" name="where" type="text" value ="';
if (isset($_POST['where'])) echo $_POST['where'];
echo '" /></TD>
<TR class ="windowbg2">
<TD width = "200px">Anything else we should consider upon reviewing your application?:</TD>
<TD><TEXTAREA id ="other" name ="other" rows="5" cols="40"  value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>

</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
                            <c>(be sure to only hit submit once)</c>
</form>
</TABLE>';


I would imagine the gap would be coming from somewhere in the following line but I have no idea how

$postbody = 'Enrollment application has been made by ' . $context['user']['name'].'[hr][html]<table>
Title: Re: [Done!] Join Us! form
Post by: ftk on June 03, 2007, 02:16:24 PM
That was a really great job~! I can imply immediately without difficulty...

BTW, can anyone tell me how to put the pre-set variable into the form so that user no need to input again (e.g. name / email / any other info from his profile etc.)

Thanks~!
Title: Re: [Done!] Join Us! form
Post by: ftk on June 07, 2007, 10:32:57 AM
just change all <> to []

here is my code:
[table]
[tr][td]Name:[/td][td] ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td] ' . $_POST['email'] . '[/td][/tr]
[tr][td]Current Game Name:[/td][td] ' . $_POST['aa_name'] . '[/td][/tr]
[tr][td]Age:[/td][td] ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td]Location:[/td][td] ' . $_POST['location'] . '[/td][/tr]
[tr][td]Current Honor:[/td][td] ' . $_POST['honor'] . '[/td][/tr]
[tr][td]Previous clan(s):[/td][td] ' . $_POST['prev_clans'] . '[/td][/tr]
[tr][td]Banned from any sever:[/td][td] ' . $_POST['banned'] . '[/td][/tr]
[tr][td]Registered with AAOTracker?[/td][td] ' . $_POST['aaotracker'] . '[/td][/tr]
[tr][td]AAOTracker name:[/td][td] ' . $_POST['aaotracker_name'] . '[/td][/tr]
[tr][td]Registred with X-fire?[/td][td] ' . $_POST['xfire'] . '[/td][/tr]
[tr][td]X-Fire Account:[/td][td] ' . $_POST['xfire_name'] . '[/td][/tr]
[tr][td]TeamSpeak installed?:[/td][td] ' . $_POST['ts'] . '[/td][/tr]
[tr][td]Have microphone/headset:[/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Would like to help pay for a server?:[/td][td] ' . $_POST['pay'] . '[/td][/tr]
[tr][td]Why do you want to join our clan?[/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Gaming habbits:[/td][td] ' . $_POST['habbits'] . '[/td][/tr]
[tr][td]Other information:[/td][td] ' . $_POST['other']. '[/td][/tr]
[/table]
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on June 22, 2007, 02:09:38 PM
Alrighty... I have made modifications to this to reflect my actual circumstances, however I can not find out how to change one aspect.  basically the code creates a new post in my specified forum witht he heading " [Pending] Application of Soandso ".  However, it uses the persons login name as the "soandso".  I want it to use the FlyFF in game name that I have in my code.  Any help would be greatly appreciated!




global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment staff member
$email_address='recruitment@frostbiteguild.net';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2;

//the id of the this article
$this_article_id = '11';

//article to be redirected when form is submitted
$thank_you_article_id = '10';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an FlyFF name
if (empty($_POST['FlyFF_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['FlyFF_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Level:  ' . $_POST['level'] . '
Previous guild(s):  ' . $_POST['prev_guilds'] . '
Banned from any server:  ' . $_POST['banned'] . '
Do you play more than one character? ' . $_POST['alt'] . '
Alternate character name:  ' . $_POST['alt_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
Ventrilo installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Do you purchase items from the Cash Shop?: ' . $_POST['pay'] . '
Why do you want to join our guild?  ' . $_POST['why'] . '
Gaming habits:   ' . $_POST['habits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['FlyFF_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Level: <td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Previous guild(s): <td></td><td> ' . $_POST['prev_guilds'] . '</td></tr>
<tr><td>Banned from any server: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Do you play more than one character? <td></td><td>' . $_POST['alt'] . '</td></tr>
<tr><td>Alternate character name:  <td></td><td>' . $_POST['alt_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>Ventrilo installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Do you purchase items from the Cash Shop?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our guild? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habits: <td></td><td> ' . $_POST['habits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Real Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current FlyFF In-Game Nick:</TD>
<TD><INPUT id="FlyFF_name" name="FlyFF_name" type="text" value ="';
if (isset($_POST['FlyFF_name'])) echo $_POST['FlyFF_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Level:</TD>
<TD><INPUT id="level" name="level" type="text" value ="';
if (isset($_POST['level'])) echo $_POST['level'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous guild(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_guilds" name="prev_guilds" rows="4" cols="40" value ="';
if (isset($_POST['prev_guilds'])) echo $_POST['prev_guilds'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any server (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you play more than one character?</TD>
<TD><SELECT id="alt" name="alt" style="WIDTH: 160px" value ="';
if (isset($_POST['alt'])) echo $_POST['alt'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Alternate character name:</TD>
<TD><INPUT id="alt_name" name="alt_name" type="text" value ="';
if (isset($_POST['alt_name'])) echo $_POST['alt_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you purchase items from the Cash Shop?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="No">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Frostbite?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habits:
</TD>
<TD><TEXTAREA id="habits" name="habits" rows="4" cols="40" value ="';
if (isset($_POST['habits'])) echo $_POST['habits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: IchBin on June 22, 2007, 03:42:19 PM
You should be able to change this line:
'subject' => '[Pending] Application of ' . $context['user']['name'],

To this:
'subject' => '[Pending] Application of ' . $_POST['FlyFF_name'],
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on June 22, 2007, 09:43:54 PM
Thank you so much Ich!
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on June 23, 2007, 07:04:39 PM
Alrighty.. last issue is that huge gap between "soandso has posted an app" and the actual questions and answers.  I didn't understand the aforementioned explanation.  Heres my code, and thank you in advance!



global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment staff member
$email_address='recruitment@frostbiteguild.net';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2;

//the id of the this article
$this_article_id = '11';

//article to be redirected when form is submitted
$thank_you_article_id = '10';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an FlyFF name
if (empty($_POST['FlyFF_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['FlyFF_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Class:  ' . $_POST['class'] . '
Current Level:  ' . $_POST['level'] . '
Previous guild(s):  ' . $_POST['prev_guilds'] . '
Banned from any server:  ' . $_POST['banned'] . '
Do you play more than one character? ' . $_POST['alt'] . '
Alternate character name:  ' . $_POST['alt_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
Ventrilo installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Do you purchase items from the Cash Shop?: ' . $_POST['pay'] . '
Why do you want to join our guild?  ' . $_POST['why'] . '
Gaming habits:   ' . $_POST['habits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['FlyFF_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Class:<td></td><td>  ' . $_POST['class'] . '</td></tr>
<tr><td>Current Level: <td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Previous guild(s): <td></td><td> ' . $_POST['prev_guilds'] . '</td></tr>
<tr><td>Banned from any server: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Do you play more than one character? <td></td><td>' . $_POST['alt'] . '</td></tr>
<tr><td>Alternate character name:  <td></td><td>' . $_POST['alt_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>Ventrilo installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Do you purchase items from the Cash Shop?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our guild? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habits: <td></td><td> ' . $_POST['habits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $_POST['FlyFF_name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Real Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current FlyFF In-Game Nick:</TD>
<TD><INPUT id="FlyFF_name" name="FlyFF_name" type="text" value ="';
if (isset($_POST['FlyFF_name'])) echo $_POST['FlyFF_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Class:</TD>
<TD><INPUT id="class" name="class" type="text" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Level:</TD>
<TD><INPUT id="level" name="level" type="text" value ="';
if (isset($_POST['level'])) echo $_POST['level'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous guild(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_guilds" name="prev_guilds" rows="4" cols="40" value ="';
if (isset($_POST['prev_guilds'])) echo $_POST['prev_guilds'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any server (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you play more than one character?</TD>
<TD><SELECT id="alt" name="alt" style="WIDTH: 160px" value ="';
if (isset($_POST['alt'])) echo $_POST['alt'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Alternate character name:</TD>
<TD><INPUT id="alt_name" name="alt_name" type="text" value ="';
if (isset($_POST['alt_name'])) echo $_POST['alt_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you purchase items from the Cash Shop?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="No">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Frostbite?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habits:
</TD>
<TD><TEXTAREA id="habits" name="habits" rows="4" cols="40" value ="';
if (isset($_POST['habits'])) echo $_POST['habits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: IchBin on June 24, 2007, 03:03:52 AM
Not knowing exactly what you're talking about this may be what you're talking about.

Remove the .'
 from the end of this line.
$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
Title: Re: [Done!] Join Us! form
Post by: CampCounselor on June 24, 2007, 01:16:29 PM
i am having that problem as well.  when you make a post it comes like 5 lines down or more.  i love this mod. thanks guys
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on June 24, 2007, 02:41:10 PM
That caused it to have a syntax error.. no more working..
Title: Re: [Done!] Join Us! form
Post by: IchBin on June 25, 2007, 05:20:44 AM
Sorry, the br got parsed in my post.

Remove just the br and not the . '
<br />
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on June 25, 2007, 03:01:22 PM
K i removed that and still have the issue... I can't seem to figure this out.  Here's my code:



global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment staff member
$email_address='recruitment@frostbiteguild.net';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2;

//the id of the this article
$this_article_id = '11';

//article to be redirected when form is submitted
$thank_you_article_id = '10';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an FlyFF name
if (empty($_POST['FlyFF_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['FlyFF_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Class:  ' . $_POST['class'] . '
Current Level:  ' . $_POST['level'] . '
Previous guild(s):  ' . $_POST['prev_guilds'] . '
Banned from any server:  ' . $_POST['banned'] . '
Do you play more than one character? ' . $_POST['alt'] . '
Alternate character name:  ' . $_POST['alt_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
Ventrilo installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Do you purchase items from the Cash Shop?: ' . $_POST['pay'] . '
Why do you want to join our guild?  ' . $_POST['why'] . '
Gaming habits:   ' . $_POST['habits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['FlyFF_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Class:<td></td><td>  ' . $_POST['class'] . '</td></tr>
<tr><td>Current Level: <td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Previous guild(s): <td></td><td> ' . $_POST['prev_guilds'] . '</td></tr>
<tr><td>Banned from any server: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Do you play more than one character? <td></td><td>' . $_POST['alt'] . '</td></tr>
<tr><td>Alternate character name:  <td></td><td>' . $_POST['alt_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>Ventrilo installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Do you purchase items from the Cash Shop?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our guild? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habits: <td></td><td> ' . $_POST['habits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $_POST['FlyFF_name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Real Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current FlyFF In-Game Nick:</TD>
<TD><INPUT id="FlyFF_name" name="FlyFF_name" type="text" value ="';
if (isset($_POST['FlyFF_name'])) echo $_POST['FlyFF_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Class:</TD>
<TD><INPUT id="class" name="class" type="text" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Level:</TD>
<TD><INPUT id="level" name="level" type="text" value ="';
if (isset($_POST['level'])) echo $_POST['level'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous guild(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_guilds" name="prev_guilds" rows="4" cols="40" value ="';
if (isset($_POST['prev_guilds'])) echo $_POST['prev_guilds'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any server (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you play more than one character?</TD>
<TD><SELECT id="alt" name="alt" style="WIDTH: 160px" value ="';
if (isset($_POST['alt'])) echo $_POST['alt'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Alternate character name:</TD>
<TD><INPUT id="alt_name" name="alt_name" type="text" value ="';
if (isset($_POST['alt_name'])) echo $_POST['alt_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you purchase items from the Cash Shop?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="No">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Frostbite?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habits:
</TD>
<TD><TEXTAREA id="habits" name="habits" rows="4" cols="40" value ="';
if (isset($_POST['habits'])) echo $_POST['habits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: IchBin on June 25, 2007, 03:14:51 PM
Sorry, but I don't see anything wrong with that code atm.
Title: Re: [Done!] Join Us! form
Post by: mebymyself on June 25, 2007, 03:17:10 PM
Sorry for my absence. For some reason I stopped receiving notifications from this post.

Bardofyouth, I think your problem is somehow related to the template you use.
Try to change all <> to [] as suggested by ftk

Instead

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['FlyFF_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Class:<td></td><td>  ' . $_POST['class'] . '</td></tr>
<tr><td>Current Level: <td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Previous guild(s): <td></td><td> ' . $_POST['prev_guilds'] . '</td></tr>
<tr><td>Banned from any server: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Do you play more than one character? <td></td><td>' . $_POST['alt'] . '</td></tr>
<tr><td>Alternate character name:  <td></td><td>' . $_POST['alt_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>Ventrilo installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Do you purchase items from the Cash Shop?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our guild? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habits: <td></td><td> ' . $_POST['habits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';


put this

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Real Name:[/td][td]  ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td]  ' . $_POST['email'] . '[/td][/tr]
[tr][td]Current Game Name:[/td][td]  ' . $_POST['FlyFF_name'] . '[/td][/tr]
[tr][td]Age:[/td][td]  ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td]' . $_POST['gender'] . '[/td][/tr]
[tr][td]Class:[/td][td]  ' . $_POST['class'] . '[/td][/tr]
[tr][td]Current Level:[/td][td] ' . $_POST['level'] . '[/td][/tr]
[tr][td]Previous guild(s):[/td][td] ' . $_POST['prev_guilds'] . '[/td][/tr]
[tr][td]Banned from any server:[/td][td] ' . $_POST['banned'] . '[/td][/tr]
[tr][td]Do you play more than one character?[/td][td]' . $_POST['alt'] . '[/td][/tr]
[tr][td]Alternate character name:[/td][td]' . $_POST['alt_name'] . '[/td][/tr]
[tr][td]Registred with X-fire? [/td][td] ' . $_POST['xfire'] . '[/td][/tr]
[tr][td]X-Fire Account: [/td][td] ' . $_POST['xfire_name'] . '[/td][/tr]
[tr][td]Ventrilo installed?:[/td][td] ' . $_POST['ts'] . '[/td][/tr]
[tr][td]Have microphone/headset:[/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Do you purchase items from the Cash Shop?[/td][td] ' . $_POST['pay'] . '[/td][/tr]
[tr][td]Why do you want to join our guild? [/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Gaming habits: [/td][td] ' . $_POST['habits'] . '[/td][/tr]
[tr][td]Other information: [/td][td] ' . $_POST['other']. '[/td][/tr]
[/table]';


EDIT:
I also removed extra [ td ] tag
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on June 25, 2007, 10:30:27 PM
That fixed it!  Thanks so much!
Title: Re: [Done!] Join Us! form
Post by: mebymyself on June 26, 2007, 02:27:28 AM
No problems!

Title: Re: [Done!] Join Us! form
Post by: ninakar on July 01, 2007, 10:26:46 PM
Well guyz...problem here

WoW Guild Site..
Just changed questions and and options of answers with various drop-down menus for answers.
Well to be correct heavily changed questions


First attemp was just changing some possible answer of questions with drop-down menu and worked fine.

So decided to go on with complete change of the application form with questions

Made that part. Put it on website and mistake
QuoteParse error: syntax error, unexpected T_STRING in /home/vincent/public_html/looneytunez/Test/TestPortal1/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 91
appeared.

After that I made the 2-3 changes mentioned in the last two pages (< /br thing)
Taking off extra <td>
and also changing the part mentioned with [] isntead of <>

Now my code looks like this

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='juohmaru@looneytunez.vincent.protia.net';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=1.0;

//the id of the this article
$this_article_id = '7';

//article to be redirected when form is submitted
$thank_you_article_id = '8';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your Character Name.';
}       

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '

Real Name: ' . $_POST['real_name'] . '
Location: ' . $_POST['location'] . '
Age: ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Email address: ' . $_POST['email'] . '
Character Name: ' . $_POST['aa_name'] . '
Character Race: ' . $_POST['race'] . '
Character Clan: ' . $_POST['class'] . '
Character Level: ' . $_POST['lvl'] . '
Attunements & Keys: ' . $_POST['attune'] . '
Learn about us: ' . $_POST['howlearn'] . '
Guild Member Real Friend: ' . $_POST['friendreal'] . '
Real Friend: ' . $_POST['who1'] . '
Guild Member Game Friend: ' . $_POST['friendgame'] . '
Game Friend: ' . $_POST['who2'] . '
Playing WoW often: ' . $_POST['often'] . '
Playing WoW hours: ' . $_POST['time'] . '
Staying Online: ' . $_POST['online'] . '
Character level up: ' . $_POST['lvlup'] . '
Number of Characters of 60 level and above: ' . $_POST['maxed'] . '
Raid Experience: ' . $_POST['raidxp'] . '
Previous guild(s): ' . $_POST['prev_guild'] . '
Why left: ' . $_POST['whyleft'] . '
Why join: ' . $_POST['whyjoin'] . '
PvP or PvE: ' . $_POST['pvppve'] . '
Additional Info: ' . $_POST['info'] . '


$postbody = 'Enrollment application made by ' . $context['user']['name'] .'
[table]
[tr][td]Real Name:[/td][td]  ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Location:[/td][td] ' . $_POST['location'] . '[/td][/tr]
[tr][td]Age:[/td][td] ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td]Email Address:[/td][td]  ' . $_POST['email'] . '[/td][/tr]
[tr][td]Character Name:[/td][td] ' . $_POST['aa_name'] . '[/td][/tr]
[tr][td]Character Race:[/td][td]' . $_POST['race'] . '[/td][/tr]
[tr][td]Character Class:[/td][td] ' . $_POST['class'] . '[/td][/tr]
[tr][td]Character Level:[/td][td] ' . $_POST['lvl'] . '[/td][/tr]
[tr][td]Attunements & Keys:[/td][td] ' . $_POST['attune'] . '[/td][/tr]
[tr][td]Learn about us:[/td][td]  . $_POST['howlearn'] . '[/td][/tr]
[tr][td]Guild Member Real Friend:[/td][td] ' . $_POST['friendreal'] . '[/td][/tr]
[tr][td]Real Friend:[/td][td] ' . $_POST['who1'] . '[/td][/tr]
[tr][td]Guild Member Game Friend:[/td][td] ' . $_POST['friendgame'] . '[/td][/tr]
[tr][td]Game Friend:[/td][td] ' . $_POST['who2'] . '[/td][/tr]
[tr][td]Playing WoW often:[/td][td] ' . $_POST['often'] . '[/td][/tr]
[tr][td]Playing WoW hours:[/td][td] ' . $_POST['time'] . '[/td][/tr]
[tr][td]Staying Online:[/td][td] ' . $_POST['online'] . '[/td][/tr]
[tr][td]Character level up:[/td][td] ' . $_POST['lvlup'] . '[/td][/tr]
[tr][td]Number of Characters of 60 level and above:[/td][td] ' . $_POST['maxed'] . '[/td][/tr]
[tr][td]Raid Experience:[/td][td] ' . $_POST['raidxp'] . '[/td][/tr]
[tr][td]Previous guild(s):[/td][td] ' . $_POST['prev_guild'] . '[/td][/tr]
[tr][td]Why left:[/td][td] ' . $_POST['whyleft'] . '[/td][/tr]
[tr][td]Why join:[/td][td] ' . $_POST['whyjoin'] . '[/td][/tr]
[tr][td]PvP or PvE:[/td][td] ' . $_POST['pvppve'] . '[/td][/tr]
[tr][td]Additional info:[/td][td] ' . $_POST['info'] . '[/td][/tr]
[/table]';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name :</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Where are you from? :</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* How old are you? :</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender :</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Male">Male</OPTION>
<OPTION value="Female">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address :</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* What is your character's name? :</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Race :</TD>
<TD><SELECT id = "race" name = "race" style="WIDTH: 152px" value ="';
if (isset($_POST['race'])) echo $_POST['race'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Blood Elf">Blood Elf</OPTION>
<OPTION value="Tauren">Tauren</OPTION>
<OPTION value="Troll">Troll</OPTION>
<OPTION value="Undead">Undead</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Class :</TD>
<TD><SELECT id = "class" name = "class" style="WIDTH: 152px" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Druid">Druid</OPTION>
<OPTION value="Hunter">Hunter</OPTION>
<OPTION value="Mage">Mage</OPTION>
<OPTION value="Paladin">Paladin</OPTION>
<OPTION value="Priest">Priest</OPTION>
<OPTION value="Rogue">Rogue</OPTION>
<OPTION value="Shaman">Male</OPTION>
<OPTION value="Warclock">Warlock</OPTION>
<OPTION value="Warrior">Warrior</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Level :</TD>
<TD><SELECT id = "lvl" name = "lvl" style="WIDTH: 152px" value ="';
if (isset($_POST['lvl'])) echo $_POST['lvl'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="1">1</OPTION>
<OPTION value="2">2</OPTION>
<OPTION value="3">3</OPTION>
<OPTION value="4">4</OPTION>
<OPTION value="5">5</OPTION>
<OPTION value="6">6</OPTION>
<OPTION value="7">7</OPTION>
<OPTION value="8">8</OPTION>
<OPTION value="9">9</OPTION>
<OPTION value="10">10</OPTION>
<OPTION value="11">11</OPTION>
<OPTION value="12">12</OPTION>
<OPTION value="13">13</OPTION>
<OPTION value="14">14</OPTION>
<OPTION value="15">15</OPTION>
<OPTION value="16">16</OPTION>
<OPTION value="17">17</OPTION>
<OPTION value="18">18</OPTION>
<OPTION value="19">19</OPTION>
<OPTION value="20">20</OPTION>
<OPTION value="21">21</OPTION>
<OPTION value="22">22</OPTION>
<OPTION value="23">23</OPTION>
<OPTION value="24">24</OPTION>
<OPTION value="25">25</OPTION>
<OPTION value="26">26</OPTION>
<OPTION value="27">27</OPTION>
<OPTION value="28">28</OPTION>
<OPTION value="29">29</OPTION>
<OPTION value="30">30</OPTION>
<OPTION value="31">31</OPTION>
<OPTION value="32">32</OPTION>
<OPTION value="33">33</OPTION>
<OPTION value="34">34</OPTION>
<OPTION value="35">35</OPTION>
<OPTION value="36">36</OPTION>
<OPTION value="37">37</OPTION>
<OPTION value="37">37</OPTION>
<OPTION value="38">38</OPTION>
<OPTION value="39">39</OPTION>
<OPTION value="40">40</OPTION>
<OPTION value="41">41</OPTION>
<OPTION value="42">42</OPTION>
<OPTION value="43">43</OPTION>
<OPTION value="44">44</OPTION>
<OPTION value="45">45</OPTION>
<OPTION value="46">46</OPTION>
<OPTION value="47">47</OPTION>
<OPTION value="48">48</OPTION>
<OPTION value="49">49</OPTION>
<OPTION value="50">50</OPTION>
<OPTION value="51">51</OPTION>
<OPTION value="52">52</OPTION>
<OPTION value="53">53</OPTION>
<OPTION value="54">54</OPTION>
<OPTION value="55">55</OPTION>
<OPTION value="56">56</OPTION>
<OPTION value="57">57</OPTION>
<OPTION value="58">58</OPTION>
<OPTION value="59">59</OPTION>
<OPTION value="60">60</OPTION>
<OPTION value="61">61</OPTION>
<OPTION value="62">62</OPTION>
<OPTION value="63">63</OPTION>
<OPTION value="64">64</OPTION>
<OPTION value="65">65</OPTION>
<OPTION value="66">66</OPTION>
<OPTION value="67">67</OPTION>
<OPTION value="68">68</OPTION>
<OPTION value="69">69</OPTION>
<OPTION value="70">70</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* State your character's attunements and keys to heroic modes :</TD>
<TD><TEXTAREA id="attune" name="attune" rows="4" cols="40" value ="';
if (isset($_POST['attune'])) echo $_POST['attune'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* How did you learn about us? :</TD>
<TD><SELECT id = "howlearn" name = "howlearn" style="WIDTH: 152px" value ="';
if (isset($_POST['howlearn'])) echo $_POST['howlearn'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Real life friend">Real life friend</OPTION>
<OPTION value="In game friend">In game friend</OPTION>
<OPTION value="Game Server">Game Server</OPTION>
<OPTION value="Internet (Google, Site)">Internet (Google, Site)</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Do you have a real time friend, who is already a member of our Guild? :</TD>
<TD><SELECT id = "friendreal" name = "friendreal" style="WIDTH: 152px" value ="';
if (isset($_POST['friendreal'])) echo $_POST['friendreal'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* If yes, who? :</TD>
<TD><INPUT id="who1" name="who1" type="text" value ="';
if (isset($_POST['who1'])) echo $_POST['who1'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Do you have an in-game friend, who is already a member of our Guild? :</TD>
<TD><SELECT id = "friendgame" name = "friendgame" style="WIDTH: 152px" value ="';
if (isset($_POST['friendgame'])) echo $_POST['friendgame'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* If yes, who? :</TD>
<TD><INPUT id="who2" name="who2" type="text" value ="';
if (isset($_POST['who2'])) echo $_POST['who2'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* How often do you play World of Warcraft? :</TD>
<TD><SELECT id = "often" name = "often" style="WIDTH: 152px" value ="';
if (isset($_POST['often'])) echo $_POST['often'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Once a week or less">Once a week or less</OPTION>
<OPTION value="Three days a week or less">Three days a week or less</OPTION>
<OPTION value="Four days a week or more">Four days a week or more</OPTION>
<OPTION value="Every day">Every day</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What time of day do you usually play? :</TD>
<TD><TEXTAREA id="time" name="time" rows="4" cols="40" value ="';
if (isset($_POST['time'])) echo $_POST['time'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">How long do you usually stay online (minutes/hours)? :</TD>
<TD><INPUT id="online" name="online" type="text" value ="';
if (isset($_POST['online'])) echo $_POST['online'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Did you level your character? :</TD>
<TD><SELECT id = "lvlup" name = "lvlup" style="WIDTH: 152px" value ="';
if (isset($_POST['lvlup'])) echo $_POST['lvlup'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Yes all the way up">Yes all the way up</OPTION>
<OPTION value="Yes, with help from help">Yes, with help from help</OPTION>
<OPTION value="No, only few levels">No, only a few levels, then friend or power level service</OPTION>
<OPTION value="No, I didn't">No, I didn't. Powered lvl, or traded character</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">How many characters you leveled up to or above 60 level?(mention classes also) :</TD>
<TD><TEXTAREA id="maxed" name="maxed" rows="4" cols="40" value ="';
if (isset($_POST['maxed'])) echo $_POST['maxed'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Inform us of your raid experience. Mention the ones you attended, which boss you reached, with which character? :</TD>
<TD><TEXTAREA id="raidxp" name="raidxp" rows="4" cols="40" value ="';
if (isset($_POST['raidxp'])) echo $_POST['raidxp'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Which was/were your previous guild(s)? :</TD>
<TD><TEXTAREA id="prev_guild" name="prev_guild" rows="4" cols="40" value ="';
if (isset($_POST['prev_guild'])) echo $_POST['prev_guild'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Why have left your previous guild(s)? :</TD>
<TD><TEXTAREA id="whyleft" name="whyleft" rows="4" cols="40" value ="';
if (isset($_POST['whyleft'])) echo $_POST['whyleft'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Why do you want to join us? :</TD>
<TD><TEXTAREA id="whyjoin" name="whuyjoin" rows="4" cols="40" value ="';
if (isset($_POST['whyjoin'])) echo $_POST['whyjoin'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you prefer PvP (Arena, BGs', Premades) or PvE (Raids, Heroics, Simple Instances)? :</TD>
<TD><SELECT id = "pvppve" name = "pvppve" style="WIDTH: 152px" value ="';
if (isset($_POST['pvppve'])) echo $_POST['pvppve'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="PvP">PvP</OPTION>
<OPTION value="PvE">PvE</OPTION>
<OPTION value="Both">Both</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision :</TD>
<TD><TEXTAREA id="info" name = "info" rows="4" cols="40" value ="';
if (isset($_POST['info'])) echo $_POST['info'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';



and still error

QuoteParse error: syntax error, unexpected T_STRING in /home/vincent/public_html/looneytunez/Test/TestPortal1/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 91

occur


and I must admit that I may be blind cause I don't find any mistake in line 91 :P
Title: Re: [Done!] Join Us! form
Post by: mebymyself on July 02, 2007, 01:30:33 AM
the mistake is in the line above (line 88)

Additional Info: ' . $_POST['info'] . '

must read

Additional Info: ' . $_POST['info'] ;


Hope this helps
Title: Re: [Done!] Join Us! form
Post by: iGate on July 02, 2007, 09:46:54 AM
awesome another AA player.

u dont mind if i use ur code do ya for our clan?...gud

we are a 2.5 clan at http://ihf.lp.pl check us out.

btw how do u modify the code to send a pm instead of an email to the required person?
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 02, 2007, 12:26:25 PM
mebymysell thnx...first mistake out.. (i also corrected something else before that)
but second mistake occur

QuoteParse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/vincent/public_html/looneytunez/Test/TestPortal1/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 215

Do u wanna play along with me "The missing dot" game? :P
Title: Re: [Done!] Join Us! form
Post by: mebymyself on July 02, 2007, 01:55:36 PM
Quote from: ninakar on July 02, 2007, 12:26:25 PM
mebymysell thnx...first mistake out.. (i also corrected something else before that)
but second mistake occur

QuoteParse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/vincent/public_html/looneytunez/Test/TestPortal1/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 215

Do u wanna play along with me "The missing dot" game? :P

I guess your problem is not escaped single quot character in
<TD width = "200px">* What is your character's name? :</TD>

change it to <TD width = "200px">* What is your character\'s name? :</TD>


Quote from: iGate on July 02, 2007, 09:46:54 AM
awesome another AA player.

u dont mind if i use ur code do ya for our clan?...gud

we are a 2.5 clan at http://ihf.lp.pl check us out.

btw how do u modify the code to send a pm instead of an email to the required person?

I dont know how to send PM instead of email. But I like the idea and I will look into it...
Just ... I am leaving for vacation for 3 week today. So you will have to wait until that

Title: Re: [Done!] Join Us! form
Post by: iGate on July 02, 2007, 02:13:36 PM
ok....any ideas then how to modify this to use pms instead?
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 02, 2007, 02:19:55 PM
Thnx again...soz for lots of questions but I'm a total noob in PHP :P

Well. resolved that last too..and also a same mistake afterwards (@ line 300+)

now got mistake on line 411

QuoteParse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/vincent/public_html/looneytunez/Test/TestPortal1/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 411

let's hope before u leave...and wish happy holidays :)
Title: Re: [Done!] Join Us! form
Post by: mebymyself on July 02, 2007, 02:22:17 PM
Quote from: iGate on July 02, 2007, 02:13:36 PM
ok....any ideas then how to modify this to use pms instead?

As I said - I don't know how to do it but i will work on it ...
about ideas ... If you know PHP you can try to reverse engineer the SMF source and see if build in function available to send PM. If not then manually insert records in smf_personal_messages and smf_pm_recipients tables

Title: Re: [Done!] Join Us! form
Post by: mebymyself on July 02, 2007, 02:26:31 PM
Quote from: ninakar on July 02, 2007, 02:19:55 PM
Thnx again...soz for lots of questions but I'm a total noob in PHP :P

Well. resolved that last too..and also a same msitake afterwars (@ line 300+)

now got mistake on line 411


QuoteParse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/vincent/public_html/looneytunez/Test/TestPortal1/Sources/Load.php(1735) : eval()'d code(209) : eval()'d code on line 411

let's hope before u leave...and wish happy holidays :)

same thing here <OPTION value="No, I didn't">No, I didn't. Powered lvl, or traded character</OPTION>

must be
<OPTION value="No, I didn\'t">No, I didn\'t. Powered lvl, or traded character</OPTION>


You should escape all single quotes ' with \ so it looks like \'
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 02, 2007, 02:35:48 PM
THNX!!!

Gosh..didn't thought that text part of the question -not code- would make such a mess..

Well no mistakes now..form is enabled..
I will test it thoroughly..

thnx a lot m8 :)

And I have a good think for anyone to make.
I want to make the code in that way so as to...

Depending the class selected from the applicant, the notification mail of the application goes to different class leader/officers mail.
Site admin & Guild Master also (for all applicants)

example:
If somebody selects Warlock for Recruiting char, I want the mail to be sent to not only site admin & GM but to the appropriate class leader for Warlocks we have.

in general
stable emails will be admin & gm
and depending on the variable of class
it will be sent to one third person, different each time

that's food for thought ;)


thnx again m8 :) and have  nice holiday :D
Title: Re: [Done!] Join Us! form
Post by: mebymyself on July 02, 2007, 02:59:04 PM
Well, I tried to keep the code as general as possible. your request is specific to your type of game only but it very easy to customize:

Just before this code:             if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);


put something like this:


switch ( $_POST['class'] ) {
case 'Druid':
    $email_address='whatever@emal.needed';
    break;
case 'Hunter':
    $email_address='whatever@emal.needed';
    break;

// put rest of the classes the same way
// case '<class name here>':
// $email_address='whatever@emal.needed';
//  break;

     
default:
    $email_address='whatever@emal.needed'; // Here put an email of general admin in case if user didn't select any class
}

Title: Re: [Done!] Join Us! form
Post by: ninakar on July 02, 2007, 03:33:46 PM
Well m8..u are awesome...
though when selcting class it sends only to the email address put in the switch faction..
and not the stable ones outside of it (such as admin mail)

but that's ok :) I don't mind..i will jsut put the address inside the switch function..

thnx again :)

I believe that this addition is great for any site (not only my specific requirement) :)


Well I get one problem..When I only put one email address it's ok
But I insert multiple mail address into the switch function (to be send to the appropriate person each time). I use the method mentioned here --> http://www.tinyportal.net/index.php?topic=9840.msg88640#msg88640 (http://www.tinyportal.net/index.php?topic=9840.msg88640#msg88640)


But it doesn't work...

[edit]
Problem solved

Instead of the way mentioned
$email_address='myemail@iinet.net.au; email2.net.au; email3.net.au';

U must use "," instead of ";" between the e-mails. So it will be this way
$email_address='myemail@iinet.net.au, email2.net.au, email3.net.au';
[/edit]
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 02, 2007, 05:48:27 PM
Well guys somebody could help now..simple php (me=noob :P )
Well..in the error check area (for necessary fill in boxes).
There i want to check email/game name/class/lvl
the two first are written by the applicant
the two last are selected from a drop down menu (which is created from the select id, option value code etc etc)

It checks for the first two..but the last two are not checked for errors (no selection).
As I have seen the current code checks only written by the applicant answers.
It does not search answers that are chosen from options of a drop down menu.


// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your Character Name.';
}       

        // Check for class
if (empty($_POST['class']) ){
$enroll_errors[] = 'You forgot to enter your Character Class.';
}


The first is checked for errors (not filled)..the second no .
What I must change in order to check the value of a drop down menu?
If u don't select anything there, the option u receive is not selected (------), maybe that confuses the code and thinks that the option has a selection and is not empty.

Any ideas?

[edit]
Solved
Problem solved here too with a help of friend.

for drop down menu options (used in select tables)
instead of

// Check for class
if (empty($_POST['class']) ){
$enroll_errors[] = 'You forgot to enter your Character Class.';
}


I used

        // Check for class
if ($_POST['class']=="No Answer") {
$enroll_errors[] = 'You forgot to enter your Character Class.';
}


and works beautifully :)
Title: Re: [Done!] Join Us! form
Post by: iGate on July 05, 2007, 12:45:50 AM
any1 know why mine is skrewing up?

http://test.ihf.lp.pl/forum/index.php?page=17


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staff member
$email_address='k.dog.qwe@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=6.0;

//the id of the this article
$this_article_id = '17';

//article to be redirected when form is submitted
$thank_you_article_id = '16';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for in game nickAAO
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your AA account name';
}
// Check for a name
if (empty($_POST['timezone']) ){
$enroll_errors[] = 'You forgot to enter your timezone.';
}
// Check for an honor
if (empty($_POST['honor']) ){
$enroll_errors[] = 'You forgot to enter your Honor Level.';
}
// Check for drAAt
if (empty($_POST['draat']) ){
$enroll_errors[] = 'You forgot to enter your drAAt link.';
}
// Check for why join?
if (empty($_POST['why']) ){
$enroll_errors[] = 'You forgot to enter why you want to join our clan.';
}     

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
drAAt Link:  ' . $_POST['draat'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>drAAt Link: <td></td><td> ' . $_POST['draat'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/forum/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . 'forum/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
<TR class= ââ,¬Å"windowbg2ââ,¬Â>
<TD width=ââ,¬Å"100%ââ,¬Â>YOUR TEXT HERE</TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Email address: *</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current AA In-Game Nick: *</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>- Please Select -</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Your Time Zone: *</TD>
<TD><SELECT id="timezone" name="timezone" type="text" value ="';
if (isset($_POST['timezone'])) echo $_POST['timezone'];   
echo '" />
<OPTION value="GMT -12">(GMT ââ,¬â€œ12:00)</OPTION>
<OPTION value="GMT -11">(GMT ââ,¬â€œ11:00)</OPTION>
<OPTION value="GMT -10">(GMT ââ,¬â€œ10:00)</OPTION>
<OPTION value="GMT -9">(GMT ââ,¬â€œ9:00)</OPTION>
<OPTION value="GMT -8">(GMT ââ,¬â€œ8:00)</OPTION>
<OPTION value="GMT -7">(GMT ââ,¬â€œ7:00)</OPTION>
<OPTION value="GMT -6">(GMT ââ,¬â€œ6:00)</OPTION>
<OPTION value="GMT -5">(GMT ââ,¬â€œ5:00)</OPTION>
<OPTION value="GMT -4">(GMT ââ,¬â€œ4:00)</OPTION>
<OPTION value="GMT -3">(GMT ââ,¬â€œ3:00)</OPTION>
<OPTION value="GMT -2">(GMT ââ,¬â€œ2:00)</OPTION>
<OPTION value="GMT -1">(GMT ââ,¬â€œ1:00)</OPTION>
<OPTION value="UTC/GMT" selected>(UTC/GMT)</OPTION>
<OPTION value="GMT +1ââ,¬Â>(GMT +1:00)</OPTION>
<OPTION value="GMT +2ââ,¬Â>(GMT +2:00)</OPTION>
<OPTION value="GMT +3ââ,¬Â>(GMT +3:00)</OPTION>
<OPTION value="GMT +4ââ,¬Â>(GMT +4:00)</OPTION>
<OPTION value="GMT +5ââ,¬Â>(GMT +5:00)</OPTION>
<OPTION value="GMT +6ââ,¬Â>(GMT +6:00)</OPTION>
<OPTION value="GMT +7ââ,¬Â>(GMT +7:00)</OPTION>
<OPTION value="GMT +8ââ,¬Â>(GMT +8:00)</OPTION>
<OPTION value="GMT +9ââ,¬Â>(GMT +9:00)</OPTION>
<OPTION value="GMT +10ââ,¬Â>(GMT +10:00)</OPTION>
<OPTION value="GMT +11ââ,¬Â>(GMT +11:00)</OPTION>
<OPTION value="GMT +12ââ,¬Â>(GMT +12:00)</OPTION>
<OPTION value="GMT +13ââ,¬Â>(GMT +13:00)</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Are you now or ever been in a clan?</TD>
<TD><SELECT id="clan" name="clan" style="WIDTH: 160px" value ="';
if (isset($_POST['clan'])) echo $_POST['clan'];   
echo '" />
<OPTION value="No answer" selected>- Please Select -</OPTION>
<OPTION value="YES">Yes ââ,¬â€œ (Complete next step)</OPTION>
<OPTION value="NO">No ââ,¬â€œ (Skip next step)</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Current Honor: *</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Registered with AAOTracker?</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>- Please Select -</OPTION>
<OPTION value="YES">Yes ââ,¬â€œ (Complete next step)</OPTION>
<OPTION value="NO">No ââ,¬â€œ (Skip next step)</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">AAOTracker Link: (find <a href=" http://aaotracker.com/playersearch.php">here</a>)</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>

<OPTION value="No answer" selected>- Please Select -</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">drAAt Link: *
(find <a href=" http://www.draat.net/playersearch/">here</a>)
</TD>
<TD><INPUT id ="draat" name ="draat" rows="4" cols="40"  value ="';
if (isset($_POST['draat'])) echo $_POST['draat'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have TeamSpeak installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>- Please Select -</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>- Please Select -</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>- Please Select -</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join =IHF=? *</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">How often do you play AA?</TD>
<TD><SELECT id="habbits" name="habbits" style="WIDTH: 160px" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];   
echo '" />
<OPTION value="No answer" selected>- Please Select -</OPTION>
<OPTION value="Daily">Daily</OPTION>
<OPTION value="Weekly">Weekly</OPTION>
<OPTION value="Monthly">Monthly</OPTION>
<OPTION value="Occasionally">Occasionally</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Which member invited you to the clan?:</TD>
<TD><INPUT id="invite" name = "invite" rows="4" cols="40" value ="';
if (isset($_POST['invite'])) echo $_POST['invite'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: JOSHSKORN on July 05, 2007, 05:47:29 AM
I'd like to append this article such that when the user submits their application, it adds an additional membergroup to their privileges (i.e. the user is now assigned the secondary group 'Applicants' which is group 25).  Any ideas?
Title: Re: [Done!] Join Us! form
Post by: iGate on July 05, 2007, 12:14:47 PM
any ideas on mine?
Title: Re: [Done!] Join Us! form
Post by: IchBin on July 05, 2007, 03:33:13 PM
Quote from: iGate on July 05, 2007, 12:14:47 PM
any ideas on mine?

Change this line and see if it makes any difference.

Find:
<TD><SELECT id="clan" name="clan" style="WIDTH: 160px" value ="';
if (isset($_POST['clan'])) echo $_POST['clan'];   
echo '" />


Replace:
<TD><SELECT id="clan" name="clan" style="WIDTH: 160px" value ="', isset($_POST['clan']) ? $_POST['clan'] : '' ,'" />
Title: Re: [Done!] Join Us! form
Post by: iGate on July 06, 2007, 12:14:08 AM
no that doesn't work. i tried deleting that part of the code but then another part of the form takes its place.

any ideas?
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 06, 2007, 09:56:17 AM
@igate..can u specify the errors that is announced??(with full code first-without deleting any parts)
Title: Re: [Done!] Join Us! form
Post by: iGate on July 06, 2007, 02:40:07 PM
well no error is actually announced..i just see this: http://test.ihf.lp.pl/forum/index.php?page=17

ill check the error log now: this is the eroor that i get:
Quote
Applying Filter: Error message '2: strftime() expects parameter 2 to be long, string given
File: /srv/4009/www/forum/teamspeak/ts_config.inc.php
Line: 453' (Clear filter)

but i think its unrelated. btw....how do i fix that error that appears?
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 06, 2007, 08:28:26 PM
can u pinpoint me where's the mistake???i'm sleepless the alst 24 hours and can't see :P
Title: Re: [Done!] Join Us! form
Post by: iGate on July 07, 2007, 02:40:30 AM
Error message '2: strftime() expects parameter 2 to be long, string given
Title: Re: [Done!] Join Us! form
Post by: IchBin on July 07, 2007, 03:25:10 AM
Notice the file iGate? It is telling you it has an error in your teamspeak file, and not anything to do with this Join Us form.
Title: Re: [Done!] Join Us! form
Post by: iGate on July 07, 2007, 06:52:13 AM
yea....i did say that this was unrelated...sry anyway....

no errors are caused by the "join us" form - whats rong. i wil try to remake it...may solve a prob or two
Title: Re: [Done!] Join Us! form
Post by: vdubbia on July 20, 2007, 03:04:17 AM
hey guys, this would be useful as a general registration page for a non gaming site as well.  how do I set this up to NOT create a new thread, just send email only for review and approval by admin?
Title: Re: [Done!] Join Us! form
Post by: JOSHSKORN on July 20, 2007, 03:11:30 AM
Quote from: vdubbia on July 20, 2007, 03:04:17 AM
hey guys, this would be useful as a general registration page for a non gaming site as well.  how do I set this up to NOT create a new thread, just send email only for review and approval by admin?

Hmm, I'm going to guess just by removing the variables which pertain to posting it to a forum.  I know there's a conguration section, right?   This is just a guess, and if it were me, I'd try it.  Alternatively, you can probably create a board that no one else sees and just have it post there.  I'm considering this as well just as a simple contact form, but then again, posting it to a forum might be a good thing as well.
Title: Re: [Done!] Join Us! form
Post by: vdubbia on July 20, 2007, 02:46:48 PM
Quote from: JOSHSKORN on July 20, 2007, 03:11:30 AM
Quote from: vdubbia on July 20, 2007, 03:04:17 AM
hey guys, this would be useful as a general registration page for a non gaming site as well.  how do I set this up to NOT create a new thread, just send email only for review and approval by admin?

Hmm, I'm going to guess just by removing the variables which pertain to posting it to a forum.  I know there's a conguration section, right?   This is just a guess, and if it were me, I'd try it.  Alternatively, you can probably create a board that no one else sees and just have it post there.  I'm considering this as well just as a simple contact form, but then again, posting it to a forum might be a good thing as well.

will try that.

why does this create a new thread anyway?  Is this something gaming related?  just asking.
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 20, 2007, 04:23:29 PM
The reason for a new thread is for all to see the applicant and exchange opinions..
u can remove all post topic section
personally I removed only the posting of applicant's email (to remain secret and be sent only to appropriate members -such as admin site and Guild master mail)
so I believe u can easily just delete the whole part of post topic on forums ;)
Title: Re: [Done!] Join Us! form
Post by: bullmeat on July 25, 2007, 04:08:53 PM
Quote from: vdubbia on July 20, 2007, 02:46:48 PM

why does this create a new thread anyway?  Is this something gaming related?  just asking.

Yes it is gaming related, many online games have social groups such as 'guilds', 'clans' 'cooperations' etc. In these instances feedback from the membership about an application is normal.
Title: Re: [Done!] Join Us! form
Post by: Northerner on July 25, 2007, 11:50:51 PM
okay, there are tons of responses here with loads of code.
i want to know as a final answer to this thread which code is
correct? where to download and where to put it all?
one final post would be so much less confusing!
thanks!
Title: Re: [Done!] Join Us! form
Post by: ninakar on July 26, 2007, 04:21:43 AM
The basic correct code is in --> http://www.tinyportal.net/index.php?topic=9840.30 (http://www.tinyportal.net/index.php?topic=9840.30) @ 2nd post of the page

after that there are many mods asked,discussed and added by each members and you have to read what each member did.
Search a bit in the thread for what extra u want.
All of us did quite a lot of reading ;)
Title: Re: [Done!] Join Us! form
Post by: nfoshell on August 04, 2007, 07:56:48 AM
this code was exactly what i was looking for, thanx
Title: Re: [Done!] Join Us! form
Post by: tomtom9800 on August 13, 2007, 04:16:37 AM
Was wondering if there is a way to actually make a php file that you can link in a block to goto just the form on a seperate page.......kinda like clicking an external link to fill the form out....I kinda dont want it on the main page but just maybe a link....And thank you for this code, been looking for this for awhile.
Title: Re: [Done!] Join Us! form
Post by: IchBin on August 13, 2007, 05:44:17 AM
If you put this in an article, then link to the article from your main page that should do it.
Title: Re: [Done!] Join Us! form
Post by: tomtom9800 on August 13, 2007, 05:55:26 AM
Thanks for the tip, will give that a go and let you know the result
Title: Re: [Done!] Join Us! form
Post by: tomtom9800 on August 26, 2007, 09:53:32 PM
Ok I created the article and everything works fine, my question is, how do I find the link to post it as a link to abother part of the forum.  When I goto manage article and click properties the link is has editarticle$ blah blah blah.  How do I reference the link??  Lol hope that make sense they way I typed it
Title: Re: [Done!] Join Us! form
Post by: IchBin on August 27, 2007, 01:32:09 AM
You can reference the link by using HTML. Read up on how to make a link at google if needed first.

Here's a site with a short example.
http://www.htmlcodetutorial.com/linking/_A_HREF.html

To make the link go where you want you can just right click on any link that you want to see where it goes and copy the url. Then paste that link into your html.

Title: Re: [Done!] Join Us! form
Post by: TimUSA on September 16, 2007, 12:49:34 AM
What code would I need to change if i wanted the "submit" button to change the member's "member group"?
Title: Re: [Done!] Join Us! form
Post by: IchBin on September 16, 2007, 04:49:13 AM
You can't just change the link. You'd have to add the code to make that change. I don't think it would be too hard, but I don't have the time to figure that out. Sorry.
Title: Re: [Done!] Join Us! form
Post by: tomtom9800 on September 22, 2007, 02:25:29 AM
Ok still really confused and lost.......I created a php article with the recruiting form and if I activate it, it works great and shows on the main page under the center block.  However as I previously discussed I dont want it on the front page.  So I tried creating a left block and link to the page but it just goes back to the main page even though the links are different.  Was I supposed to create the actualy php under article manager somewhere else??  Did I do it correctly??  I created it in article manager......

Sorry been tryin for weeks to get the correct and cant seem to get it.  I am able to do links though, so once I get it looking at the different page, I will be straight, just stuck on getting the correct link to the article and going to a new page....

Thanks for the help in advance.
Title: Re: [Done!] Join Us! form
Post by: Hairy on September 22, 2007, 03:47:29 AM
You have to leave it on "activate" and turn off "featured"

Featured makes it appear on the front page

If you de-activate, it is no longer viewable at all and you will keep getting sent to the front page if you go to view it.

Cheers

Edit: this might be an easier explanation to get it to work.....back-track to when it appeared on the front page and go to the article manager section. It is probably set as "featured (turn off)".....click on "featured (turn off)" to stop it from appearing on the front page

Now you need to make the article you normally have on the front page set as "featured" to get that one back on the front page.
Title: Re: [Done!] Join Us! form
Post by: JOSHSKORN on September 29, 2007, 03:34:38 AM
I know this was asked on an earlier page of the thread but I don't think anyone followed up onto it.  Basically, I'm looking to add text to the top of my application.  Please help.  I tried just pasting it in, then tried putting an echo statement beforehand, surrounded by '      ';.  Here's the text:

Would you like to contact us?  Feel free to use our contact form.  Please note that we do have separate contact pages for different reasons.  Do not use this form to dispute your bans, request scrims or apply to us.  Instead, if you'd like to make a suggestion about our clan, address an issue about our website or voice a concern, you may do so this way.  Please note that you must be a registered member of our forums to submit any contacts with us.  Otherwise, you may E-mail us directly at 3iClan@gmail.com.

Click here to proceed to our contact form.  Thanks!

That's in size 4, or medium.

Here's my Contact code:

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the contact by email?
$enable_email=true;

// email address of reqruitment staff member
$email_address='3iclan@gmail.com';

//post the contact on forum?
$enable_post=true;

//board id to which the contact should be posted
$board_id=78.0;

//the id of the this article
$this_article_id = '17';

//article to be redirected when form is submitted
$thank_you_article_id = '16';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for User name
if (empty($_POST['name']) ){
$enroll_errors[] = 'You forgot to enter your Gamer Name.  How will we know who you are?';
}

// Check for body text
if (empty($_POST['body_text']) ){
$enroll_errors[] = 'You forgot to enter your E-mail text.  How do we know what to help you with?';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email the contact

$subject = $_POST['esubject'];
$body = 'E-mail correspondance by ' . $context['user']['name'] .
'from IP Address ' . $user_info['ip'] . '
Gamer Name:  ' . $_POST['name'] . '
Email address:  ' . $_POST['email'] . '
Subject: ' . $_POST['esubject'] . '
Body Text:  '. $_POST['body_text'];

$postbody = 'E-mail correspondance received by ' . $context['user']['name'] .'<br />;
<table>
<tr><td>Profile Name:<td></td><td>  ' . $_POST['name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Subject: <td></td><td>' . $_POST['esubject'] . '</td></tr>
<tr><td>Body text: <td></td><td> ' . $_POST['body_text'] . '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => $esubject,
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/thesite/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">

<TR class ="windowbg">
<TD width = "200px">* Player Name:</TD>
<TD><INPUT id="game_name" name="game_name" type="text" value ="';
if (isset($_POST['game_name'])) echo $_POST['name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Subject:</TD>
<TD><SELECT id = "esubject" name = "esubject" style="WIDTH: 152px" value ="';
if (isset($_POST['esubject'])) echo $_POST['esubject'];   
echo '" />
<OPTION value="General Inquiry" selected>General Inquiry</OPTION>
<OPTION value="Unban Request Status">Unban Request Status</OPTION>
<OPTION value="Appication Inquiry">Application Inquiry</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">*Enter your e-mail here:</TD>
<TD><TEXTAREA id="body_text" name="body_text" rows="7" cols=80" value ="';
if (isset($_POST['body_text'])) echo $_POST['bod_text'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';

Title: Re: [Done!] Join Us! form
Post by: IchBin on September 29, 2007, 03:37:46 AM
Remember when you echo something with single quotes if there are any additional single quotes in your text they have to be escaped. Read my little explanation here if you'd like.
http://www.ichbin.us/index.php?topic=19.0
Title: Re: [Done!] Join Us! form
Post by: JOSHSKORN on September 29, 2007, 03:59:49 AM
Thanks for the reply.  I got it to work but not to my liking.  Basically what I did was pasted my text in between single quotes that followed the echo statement.  I placed this right at the beginning.  This produced pure text.  I took the easy way out and got rid of single quotes within my text to make my life easier.  Example:


echo 'Would you like to contact us?  Feel free to use our contact form.  Please note that we do have separate contact pages for different reasons.  Do not use this form to dispute your bans, request scrims or apply to us.  Instead, if you'd like to make a suggestion about our clan, address an issue about our website or voice a concern, you may do so this way.  Please note that you must be a registered member of our forums to submit any contacts with us.  Otherwise, you may E-mail us directly at 3iClan@gmail.com.

Click here to proceed to our contact form.  Thanks!';


This version did not recognize paragraph breaks.

When I put in the actual version I wanted, it kept choking on some of the HTML code.

Sorry for not specifying that earlier.  Basically, this is the SOURCE version of the article I want to add to the start of my form.  Basically it's the same text as above, but note the links and the font size = 4.


<font size="4">Would you like to contact us?  Feel free to use our contact form.  Please note that we do have separate contact pages for different reasons.  Do not use this form to dispute your bans, request scrims or apply to us.  Instead, if you'd like to make a suggestion about our clan, address an issue about our website or voice a concern, you may do so this way.  Please note that you must be a registered member of our forums to submit any contacts with us.  Otherwise, you may E-mail us directly at <a href="mailto:3iclan@gmail.com">3iClan@gmail.com</a>.<br />
<br />
Click <a href="http://clansrv.crazynomad.net/thesite/index.php?page=17">here</a> to proceed to our contact form.  Thanks!</font>


Please show me how to intermix these correctly.  Thanks.
Title: Re: [Done!] Join Us! form
Post by: Hairy on September 29, 2007, 06:39:29 AM
I think if you read Ichbin's link (I have not read it myself) it explains that you need to put \ before any single quotes in the text, otherwise you have issues

so change you'd to you\'d

Have a fiddle with it after doing that.

Cheers
Title: Re: [Done!] Join Us! form
Post by: JOSHSKORN on September 29, 2007, 09:09:53 AM
How can I modify this such that it will get the date of birth from the smf_members table, calculate the age, test if the applicant's age is over 18 or not and produce an error message if under 18?
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on October 24, 2007, 02:19:51 PM
Okay, having this problem again.  I know you showed me how to fix it some half a year ago but when i tried that i didnt get the desired effect.  Still getting a very large space after "appliaction has been made by" and the actual app.

Here is my code, any help is greatly appreciated!

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='alexanderjmackowiak@yahoo.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=10.0;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Level:  ' . $_POST['honor'] . '
Previous Guild(s):  ' . $_POST['prev_clans'] . '
Class:  ' . $_POST['banned'] . '
Do you have raiding experience ' . $_POST['aaotracker'] . '
Describe that experience:  ' . $_POST['aaotracker_name'] . '
Do you have any professions  ' . $_POST['xfire'] . '
Which Professions(include skill):  ' . $_POST['xfire_name'] . '
Ventrilo installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Have you read our guild Constitution and Charter: ' . $_POST['pay'] . '
Why do you want to join our Guild  ' . $_POST['why'] . '
Do you know anyone in Affliction:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Level: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous Guild(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Class: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Do you have raiding experience <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>Describe that experience:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Do you have any professions <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>Which Professions(include skill): <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>Ventrilo installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Have you read our guild Constitution and Charter:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our Guild <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Do you know anyone in Affliction: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current In-Game Name:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Level:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous Guild(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Class:</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have raiding experience</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Describe that experience:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have any professions</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Which Professions(include skill):</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Have you read our guild Constitution and Charter:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Affliction</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you know anyone in Affliction:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: Hairy on October 24, 2007, 02:56:14 PM
http://www.tinyportal.net/index.php?topic=9840.msg140203#msg140203
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on October 24, 2007, 03:10:14 PM
Yea.. as I previously mentioned...I did that and got no intended effects.  But thank you for the copy and paste to the exact thread i was referring to =)
Title: Re: [Done!] Join Us! form
Post by: Hairy on October 25, 2007, 04:01:05 AM
Sorry, didn't see that part =D

I had the same problem as you and following that post helped to fix the problem for me.

I think you might have just copied the code wrong?

To make it easier, just copy and paste (I made the spacing a bit better then the original answer, still 99% the same):

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='alexanderjmackowiak@yahoo.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=10.0;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Level:  ' . $_POST['honor'] . '
Previous Guild(s):  ' . $_POST['prev_clans'] . '
Class:  ' . $_POST['banned'] . '
Do you have raiding experience ' . $_POST['aaotracker'] . '
Describe that experience:  ' . $_POST['aaotracker_name'] . '
Do you have any professions  ' . $_POST['xfire'] . '
Which Professions(include skill):  ' . $_POST['xfire_name'] . '
Ventrilo installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Have you read our guild Constitution and Charter: ' . $_POST['pay'] . '
Why do you want to join our Guild  ' . $_POST['why'] . '
Do you know anyone in Affliction:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Real Name:[/td][td] ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td] ' . $_POST['email'] . '[/td][/tr]
[tr][td]Current Game Name:[/td][td] ' . $_POST['aa_name'] . '[/td][/tr]
[tr][td]Age:[/td][td] ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td]Location:[/td][td] ' . $_POST['location'] . '[/td][/tr]
[tr][td]Current Level:[/td][td] ' . $_POST['honor'] . '[/td][/tr]
[tr][td]Previous Guild(s):[/td][td] ' . $_POST['prev_clans'] . '[/td][/tr]
[tr][td]Class:[/td][td] ' . $_POST['banned'] . '[/td][/tr]
[tr][td]Do you have raiding experience[/td][td] ' . $_POST['aaotracker'] . '[/td][/tr]
[tr][td]Describe that experience:[/td][td] ' . $_POST['aaotracker_name'] . '[/td][/tr]
[tr][td]Do you have any professions[/td][td] ' . $_POST['xfire'] . '[/td][/tr]
[tr][td]Which Professions(include skill):[/td][td] ' . $_POST['xfire_name'] . '[/td][/tr]
[tr][td]Ventrilo installed?:[/td][td] ' . $_POST['ts'] . '[/td][/tr]
[tr][td]Have microphone/headset:[/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Have you read our guild Constitution and Charter:[/td][td] ' . $_POST['pay'] . '[/td][/tr]
[tr][td]Why do you want to join our Guild[/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Do you know anyone in Affliction:[/td][td] ' . $_POST['habbits'] . '[/td][/tr]
[tr][td]Other information:[/td][td] ' . $_POST['other']. '[/td][/tr]
[/table]';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current In-Game Name:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Level:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous Guild(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Class:</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have raiding experience</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Describe that experience:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have any professions</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Which Professions(include skill):</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Have you read our guild Constitution and Charter:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Affliction</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you know anyone in Affliction:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: Bardofyouth on October 26, 2007, 04:25:05 PM
Awesome, thanks so much Hairy!
Title: Re: [Done!] Join Us! form
Post by: Eleven0 on November 07, 2007, 05:37:19 AM
how do i get this work with custom action?
Title: Re: [Done!] Join Us! form
Post by: Anthea on January 07, 2008, 09:49:15 PM
Quote from: Ryushi32 on January 24, 2007, 12:37:22 AM
I was wondering how to create a poll in the post with the application

I was wondering about doing this too. It would be nice to automatically have a poll posted with the application, should you need to have a group of people vote on this.

Any ideas on how this could be done? :)

Title: Re: [Done!] Join Us! form
Post by: Craven on January 09, 2008, 06:47:37 PM
Find This:
// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='alexanderjmackowiak@yahoo.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=10.0;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION


Change to this:
// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='alexanderjmackowiak@yahoo.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=10;

//the id of the this article
$this_action_id = 'Name of Action';


//END OF CONFIGURATION SECTION


Notice:
//the id of the this article
$this_action_id = 'Name of Action';

This needs to be whatever you name you Custom Action and Discription
Title: Re: [Done!] Join Us! form
Post by: Hairy on January 10, 2008, 03:18:58 AM
Quote from: [BOU] C-R-E-E-D on January 09, 2008, 06:47:37 PM
Find This:
// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='alexanderjmackowiak@yahoo.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=10.0;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION


Change to this:
// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='alexanderjmackowiak@yahoo.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=10;

//the id of the this article
$this_action_id = 'Name of Action';


//END OF CONFIGURATION SECTION


Notice:
//the id of the this article
$this_action_id = 'Name of Action';

This needs to be whatever you name you Custom Action and Discription

:o I don't understand how that could help, if anything it stops it from working wouldn't it? :-\
Title: Re: [Done!] Join Us! form
Post by: Craven on January 11, 2008, 03:53:34 PM
The question above was "How do I use this in a Custom Action?" which is a SMF Mod that allows you to do article like pages without have Tinyportals installed.  So I was explaining the changes that needed to be made to get it to work outside of Tinyportals.

Title: Re: [Done!] Join Us! form
Post by: Hairy on January 11, 2008, 04:22:26 PM
Ah, my apologies I wasn't aware of that.  :)

I think they would have to chage the following parts of the code as well:
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">


and

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/thesite/index.php?page=' . $thank_you_article_id);


But I don't know how the Custom action works, if you do then that would be great if you can post further instructions.

Cheers :up:
Title: Re: [Done!] Join Us! form
Post by: Craven on January 11, 2008, 06:16:16 PM
Yes, I forgot about those sections....

Thank you,
Title: Re: [Done!] Join Us! form
Post by: harlequindreamsx on January 27, 2008, 04:58:46 AM
I'm getting this error..

Fatal error: Call to undefined function createPost() in /www/itrello.com/i/o/w/iowg/htdocs/forum/Sources/Load.php(1049) : eval()'d code(209) : eval()'d code on line 143

with this code and its making me very sad.. see --> :'(

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir . '/Subs-Post.php');




// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of reqruitment staf member
$email_address='xxx';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=6.0;

//the id of the this article
$this_article_id = '6';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Level:  ' . $_POST['honor'] . '
Previous Guild(s):  ' . $_POST['prev_clans'] . '
Class:  ' . $_POST['banned'] . '
Do you have raiding experience ' . $_POST['aaotracker'] . '
Describe that experience:  ' . $_POST['aaotracker_name'] . '
Do you have any professions  ' . $_POST['xfire'] . '
Which Professions(include skill):  ' . $_POST['xfire_name'] . '
Ventrilo installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Have you read our guild Constitution and Charter: ' . $_POST['pay'] . '
Why do you want to join our Guild  ' . $_POST['why'] . '
Do you know anyone in Affliction:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Real Name:[/td][td] ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td] ' . $_POST['email'] . '[/td][/tr]
[tr][td]Current Game Name:[/td][td] ' . $_POST['aa_name'] . '[/td][/tr]
[tr][td]Age:[/td][td] ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td]Location:[/td][td] ' . $_POST['location'] . '[/td][/tr]
[tr][td]Current Level:[/td][td] ' . $_POST['honor'] . '[/td][/tr]
[tr][td]Previous Guild(s):[/td][td] ' . $_POST['prev_clans'] . '[/td][/tr]
[tr][td]Class:[/td][td] ' . $_POST['banned'] . '[/td][/tr]
[tr][td]Do you have raiding experience[/td][td] ' . $_POST['aaotracker'] . '[/td][/tr]
[tr][td]Describe that experience:[/td][td] ' . $_POST['aaotracker_name'] . '[/td][/tr]
[tr][td]Do you have any professions[/td][td] ' . $_POST['xfire'] . '[/td][/tr]
[tr][td]Which Professions(include skill):[/td][td] ' . $_POST['xfire_name'] . '[/td][/tr]
[tr][td]Ventrilo installed?:[/td][td] ' . $_POST['ts'] . '[/td][/tr]
[tr][td]Have microphone/headset:[/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Have you read our guild Constitution and Charter:[/td][td] ' . $_POST['pay'] . '[/td][/tr]
[tr][td]Why do you want to join our Guild[/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Do you know anyone in Affliction:[/td][td] ' . $_POST['habbits'] . '[/td][/tr]
[tr][td]Other information:[/td][td] ' . $_POST['other']. '[/td][/tr]
[/table]';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/forum/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current In-Game Name:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Level:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous Guild(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Class:</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have raiding experience</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Describe that experience:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have any professions</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Which Professions(include skill):</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Have you read our guild Constitution and Charter:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Affliction</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you know anyone in Affliction:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: Hairy on January 27, 2008, 05:57:01 AM
The first thing I have noticed in your code, find:
require_once($sourcedir . '/Subs-Post.php');

Replace with:

require_once($sourcedir .'/Subs-Post.php');

Notice you have an extra space before

'/Subs-Post.php');

Hope that gives you a smily face ----> :)
Title: Re: [Done!] Join Us! form
Post by: harlequindreamsx on January 27, 2008, 06:34:34 AM
i fixed that but im still getting the same error  :'(
Title: Re: [Done!] Join Us! form
Post by: Hairy on January 27, 2008, 07:08:56 AM
The only other thing I can see needs fixing probably won't fix your error.

Find:
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/forum/index.php?page=' . $thank_you_article_id);

Notice how you have '/forum/index.php?page='

But 4 lines down it's missing "/forum" for the error page code
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );



If your site is using "/forum" folder you need to add it in for the error page also, if it is not using that folder then you need to remove "/forum" from
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/forum/index.php?page=' . $thank_you_article_id);
Title: Re: [Done!] Join Us! form
Post by: harlequindreamsx on January 27, 2008, 07:14:52 AM
you're right it didn't fix it >.<
Title: Re: [Done!] Join Us! form
Post by: IchBin on January 27, 2008, 07:15:33 AM
harlequindreams, did you even read through this topic? Your error has already been covered, and several suggestions have been given. Please take a read.
Title: Re: [Done!] Join Us! form
Post by: harlequindreamsx on January 27, 2008, 07:23:21 AM
Quote from: IchBinâ,,¢ on January 27, 2008, 07:15:33 AM
harlequindreams, did you even read through this topic? Your error has already been covered, and several suggestions have been given. Please take a read.

yes i have read the topic i spent several hours reading and rereading over this topic
Title: Re: [Done!] Join Us! form
Post by: harlequindreamsx on January 27, 2008, 12:06:24 PM
Ok I went all the way back through this topic so I could make this post. I also snagged a different copy of the code that supposedly had no errors... (it had syntax errors so i fixed those.)

On my site:
The article with the form is: http://iowg.itrello.com/index.php?page=8
The thank you page is: http://iowg.itrello.com/index.php?page=9

I can avoid the error completely and get to the thank you page only if I have it set up like this:

//board id to which the application should be posted
$board_id=11.0;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '9';


Which is like the problem in this post (http://www.tinyportal.net/index.php?topic=9840.msg99796#msg99796) so I went here (http://www.tinyportal.net/index.php?topic=9840.msg85095#msg85095) to try and find a fix which led me to change this:

header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);


to this:

header('Location: http://iowg.itrello.com/index.php?page=9' );


With the page numbers set correctly I still get the 'Fatal error: Call to undefined function createPost() in....' error. And if I switch the numbers I don't get the errors. Either way nothing gets posted to the forum which is pretty much the whole point of me doing this.

The only person who posted with my original problem is here (http://www.tinyportal.net/index.php?topic=9840.msg109649#msg109649) and they were told to add this "up at the top of the code (the configureation section)" (their code started at the configuration portion of the code):


global $sourcedir;
require_once($sourcedir . '/Subs-Post.php');


Do I need to have this in the configuration section?

My file already includes this above my configuration setting but I am still receiving the error.


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');




An dnow I'll post the entire revised code.


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of reqruitment staf member
$email_address='harlequindreamsx@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=11.0;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '9';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}

if (empty($enroll_errors)) { //Everything seems to be OK

        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Level:  ' . $_POST['honor'] . '
Previous Guild(s):  ' . $_POST['prev_clans'] . '
Class:  ' . $_POST['banned'] . '
Do you have raiding experience ' . $_POST['aaotracker'] . '
Describe that experience:  ' . $_POST['aaotracker_name'] . '
Do you have any professions  ' . $_POST['xfire'] . '
Which Professions(include skill):  ' . $_POST['xfire_name'] . '
Ventrilo installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Have you read our guild Constitution and Charter: ' . $_POST['pay'] . '
Why do you want to join our Guild  ' . $_POST['why'] . '
Do you know anyone in Affliction:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Real Name:[/td][td] ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td] ' . $_POST['email'] . '[/td][/tr]
[tr][td]Current Game Name:[/td][td] ' . $_POST['aa_name'] . '[/td][/tr]
[tr][td]Age:[/td][td] ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td]Location:[/td][td] ' . $_POST['location'] . '[/td][/tr]
[tr][td]Current Level:[/td][td] ' . $_POST['honor'] . '[/td][/tr]
[tr][td]Previous Guild(s):[/td][td] ' . $_POST['prev_clans'] . '[/td][/tr]
[tr][td]Class:[/td][td] ' . $_POST['banned'] . '[/td][/tr]
[tr][td]Do you have raiding experience[/td][td] ' . $_POST['aaotracker'] . '[/td][/tr]
[tr][td]Describe that experience:[/td][td] ' . $_POST['aaotracker_name'] . '[/td][/tr]
[tr][td]Do you have any professions[/td][td] ' . $_POST['xfire'] . '[/td][/tr]
[tr][td]Which Professions(include skill):[/td][td] ' . $_POST['xfire_name'] . '[/td][/tr]
[tr][td]Ventrilo installed?:[/td][td] ' . $_POST['ts'] . '[/td][/tr]
[tr][td]Have microphone/headset:[/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Have you read our guild Constitution and Charter:[/td][td] ' . $_POST['pay'] . '[/td][/tr]
[tr][td]Why do you want to join our Guild[/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Do you know anyone in Affliction:[/td][td] ' . $_POST['habbits'] . '[/td][/tr]
[tr][td]Other information:[/td][td] ' . $_POST['other']. '[/td][/tr]
[/table]';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);

if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://iowg.itrello.com/index.php?page=9' );

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current In-Game Name:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Level:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous Guild(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Class:</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have raiding experience</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Describe that experience:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have any professions</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Which Professions(include skill):</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Have you read our guild Constitution and Charter:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Affliction</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you know anyone in Affliction:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';



Title: Re: [Done!] Join Us! form
Post by: Hairy on January 27, 2008, 01:11:04 PM
Are you using the latest version of SMF?
Title: Re: [Done!] Join Us! form
Post by: harlequindreamsx on January 27, 2008, 10:14:59 PM
Quote from: Hairy on January 27, 2008, 01:11:04 PM
Are you using the latest version of SMF?

I installed the current version today and everything works now :)
Title: Re: [Done!] Join Us! form
Post by: CampCounselor on February 06, 2008, 12:16:19 AM
I need the code again guys. it is a little hard to read through this. the code is posted in so many posts. I did have it working but it is not working now. I have the form displace

the site it is in is localhost/ACE. After I submit it it is sending me to mike-pc/xampp or localhost/xampp. Not what i want.

below is my code


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='recruitement@your-clan.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=1;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="/index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current AA In-Game Nick:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Honor:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registered with AAOTracker?</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">AAOTracker name:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have TeamSpeak installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join -WoW-?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: Hairy on February 06, 2008, 01:14:35 AM
See if this works for you:

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='recruitement@your-clan.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=1;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: '.$scripturl.'?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: '.$scripturl.'?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="/index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current AA In-Game Nick:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Honor:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registered with AAOTracker?</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">AAOTracker name:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have TeamSpeak installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join -WoW-?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';



I just replaced the 2 entries ofhttp://' . $_SERVER['HTTP_HOST'] . '/index.php

with '.$scripturl.'

This should avoid problems where people have their forums in a folder extension (I think) :)
Title: Re: [Done!] Join Us! form
Post by: CampCounselor on February 06, 2008, 01:38:48 AM
had another person help me but i also have a problem with the amoutn of space between the first line and the second line of hte post

i also can not edit the post because i will do that and then have it just show html code

EDIT
hairy what theme is that?
Title: Re: [Done!] Join Us! form
Post by: Hairy on February 06, 2008, 02:43:42 AM
See this code

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';


Yours needs to be like this (you need to change back all the questions to yours)

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Real Name:[/td][td] ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td] ' . $_POST['email'] . '[/td][/tr]
[tr][td]Current Game Name:[/td][td] ' . $_POST['aa_name'] . '[/td][/tr]
[tr][td]Age:[/td][td] ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td]Location:[/td][td] ' . $_POST['location'] . '[/td][/tr]
[tr][td]Current Level:[/td][td] ' . $_POST['honor'] . '[/td][/tr]
[tr][td]Previous Guild(s):[/td][td] ' . $_POST['prev_clans'] . '[/td][/tr]
[tr][td]Class:[/td][td] ' . $_POST['banned'] . '[/td][/tr]
[tr][td]Do you have raiding experience[/td][td] ' . $_POST['aaotracker'] . '[/td][/tr]
[tr][td]Describe that experience:[/td][td] ' . $_POST['aaotracker_name'] . '[/td][/tr]
[tr][td]Do you have any professions[/td][td] ' . $_POST['xfire'] . '[/td][/tr]
[tr][td]Which Professions(include skill):[/td][td] ' . $_POST['xfire_name'] . '[/td][/tr]
[tr][td]Ventrilo installed?:[/td][td] ' . $_POST['ts'] . '[/td][/tr]
[tr][td]Have microphone/headset:[/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Have you read our guild Constitution and Charter:[/td][td] ' . $_POST['pay'] . '[/td][/tr]
[tr][td]Why do you want to join our Guild[/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Do you know anyone in Affliction:[/td][td] ' . $_POST['habbits'] . '[/td][/tr]
[tr][td]Other information:[/td][td] ' . $_POST['other']. '[/td][/tr]
[/table]';


That fixes both spacing and editing issues.


QuoteEDIT
hairy what theme is that?
You mean my site? You like it?? I converted it from an existing theme :)
QuoteTheme Pirates By Aku | Converted To America's Army By =SAMS=Hairy

Cheers
Title: Re: [Done!] Join Us! form
Post by: CampCounselor on February 06, 2008, 03:51:29 AM
would be wondering if we could use it?

edit
worked like a charm. thanks!
Title: Re: [Done!] Join Us! form
Post by: tc3driver on February 20, 2008, 05:48:05 AM
A while ago I took some of the snippets here and have since made my own version according to my guilds needs, I thought I would share.

the Form.
Code (php) Select

<? php

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');
if (empty($context['user']['name'])){
     header('location: http://fatalfury.digitalmalice.com/?page=9');
}

// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment staff member
$email_address=array('email1@email.com', 'email2@email.com', 'email3@email.com') ;

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2.0;

//the id of the this article
$this_article_id = '8';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

        // Check that user is logged in
if (empty($context['user']['name'])){
                $enrole_errors[] = 'You must <a href="?action=login">login</a> or <a href="?action=register">register</a> before you can apply.';
        }

// Check for a name
if (empty($_POST['First_name']) ){
$enroll_errors[] = 'You forgot to enter your First name.';
}
if (empty($_POST['Last_name']) ){
$enroll_errors[] = 'You forgot to enter your Last name.';
        }
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['cname']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';

if ($_POST['Make']=='-1'){
$enroll_errors[] = 'You need to define your race';
}
if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application
if ($_POST['Make']=='1'){
$race='Blood Elf';
}
elseif ($_POST['Make']=='2'){
$race='Orc';
}
elseif ($_POST['Make']=='3'){
$race='Tauren';
}
elseif ($_POST['Make']=='4'){
$race='Troll';
}
elseif ($_POST['Make']=='5'){
$race='Undead';
}
$subject = 'Enrollment Application for Fatal Fury';
$body = 'Enrollment application has been made by ' . $context['user']['name'] . 
' from IP Address ' . $user_info['ip'] . '
Personal Information:
---------------------------------
Real Name:  ' . $_POST['First_name'] .' '. $_POST['Last_name']. '
Email address:  ' . $_POST['email'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '

Player Character Information:
----------------------------------
Toon Name:  ' . $_POST['cname'] . '
Current Level:  ' . $_POST['lvl'] . '
Previous Guild(s):  ' . $_POST['prev_clans'] . '
Race: ' . $race  . '
Class:  ' . $_POST['clas'] . '
Attunments: ' . $_POST['attun'] . '
Do you have raiding experience ' . $_POST['raid_exp'] . '
Describe that experience:  ' . $_POST['raid_exp_disc'] . '
Primary Profession 1:  ' . $_POST['profession_1_lvl'] .' '. $_POST['profession_1'] . '
Primary Profession 2:  ' . $_POST['profession_2_lvl'] .' '. $_POST['profession_2'] . '
Cooking Level:  ' . $_POST['cooking'] . '
First Aid Level:  ' . $_POST['first_aid'] . '
Fishing Level:  ' . $_POST['fishing'] . '

Vent Usability
----------------------------------
Ventrilo installed?:  ' . $_POST['vent'] . '
Have microphone/headset:  ' . $_POST['mic'] . '

Playing times:
---------------------------------
Monday: '. $_POST['mon_start'] .' - '. $_POST['mon_finish'] .'
Tuesday: '. $_POST['tue_start'] .' - '. $_POST['tue_finish'] .'
Wednesday: '. $_POST['wed_start'] .' - '. $_POST['wed_finish'] .'
Thursday: '. $_POST['thu_start'] .' - '. $_POST['thu_finish'] .'
Friday: '. $_POST['fri_start'] .' - '. $_POST['fri_finish'] .'
Saturday: '. $_POST['sat_start'] .' - '. $_POST['sat_finish'] .'
Sunday: '. $_POST['sun_start'] .' - '. $_POST['sun_finish'] .'

Other Information:
---------------------------------
Why do you want to join our Guild  ' . $_POST['why'] . '
Do you know anyone in Fatal Fury:   ' . $_POST['friend'] . '
How did you find our site: ' . $_POST['how'] . '
How often do you visit our web site: ' . $_POST['visit'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'
[table]
[tr][td][b][color=#f0ba00]Personal Information:[/color][/b][/td][/tr]
[tr][td][color=#f0ba00]real Name:[/color][/td][td]  ' . $_POST['First_name'] .' '. $_POST['Last_name']. '[/td][/tr]
[tr][td][color=#f0ba00]Email address:[/color][/td][td]  ' . $_POST['email'] . '[/td][/tr]
[tr][td][color=#f0ba00]Age:[/color][/td][td]  ' . $_POST['age'] . '[/td][/tr]
[tr][td][color=#f0ba00]Gender:[/color][/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td][color=#f0ba00]Location:[/color][/td][td]  ' . $_POST['location'] . '[/td][/tr]
[tr][td][color=#f0ba00][b]Player Character Information:[/b][/color][/td][/tr]
[tr][td][color=#f0ba00]Toon Name:[/color][/td][td]  ' . $_POST['cname'] . '[/td][/tr]
[tr][td][color=#f0ba00]Current Level:[/color][/td][td]  ' . $_POST['lvl'] . '[/td][/tr]
[tr][td][color=#f0ba00]Previous Guild(s):[/color][/td][td]  ' . $_POST['prev_clans'] . '[/td][/tr]
[tr][td][color=#f0ba00]Race:[/color][/td][td] ' . $race . '[/td][/tr]
[tr][td][color=#f0ba00]Class:[/color][/td][td]  ' . $_POST['clas'] . '[/td][/tr]
[tr][td][color=#f0ba00]Attunments:[/color][/td][td] ' . $_POST['attun'] . '[/td][/tr]
[tr][td][color=#f0ba00]Do you have raiding experience:[/color][/td][td] ' . $_POST['raid_exp'] . '[/td][/tr]
[tr][td][color=#f0ba00]Describe that experience:[/color][/td][td]  ' . $_POST['raid_exp_disc'] . '[/td][/tr]
[tr][td][color=#f0ba00]Primary Profession 1:[/color][/td][td]  ' . $_POST['profession_1_lvl'] .' '.  $_POST['profession_1'] . '[/td][/tr]
[tr][td][color=#f0ba00]Primary Profession 2:[/color][/td][td]  ' . $_POST['profession_2_lvl'] .' '.  $_POST['profession_2'] . '[/td][/tr]
[tr][td][color=#f0ba00]Cooking Level:[/color][/td][td]  ' . $_POST['cooking'] . '[/td][/tr]
[tr][td][color=#f0ba00]First Aid Level:[/color][/td][td]  ' . $_POST['first_aid'] . '[/td][/tr]
[tr][td][color=#f0ba00]Fishing Level:[/color][/td][td]  ' . $_POST['fishing'] . '[/td][/tr]
[tr][td][color=#f0ba00][b]Vent Usability:[/b][/color][/td][/tr]
[tr][td][color=#f0ba00]Ventrilo installed?:[/color][/td][td]  ' . $_POST['vent'] . '[/td][/tr]
[tr][td][color=#f0ba00]Have microphone/headset:[/color][/td][td]  ' . $_POST['mic'] . '[/td][/tr]
[tr][td][color=#f0ba00][b]Playing times:[/b][/color][/td][/tr]
[tr][td][color=#f0ba00]Monday:[/color][/td][td] '. $_POST['mon_start'] .' - '. $_POST['mon_finish'] .'[/td][/tr]
[tr][td][color=#f0ba00]Tuesday:[/color][/td][td] '. $_POST['tue_start'] .' - '. $_POST['tue_finish'] .'[/td][/tr]
[tr][td][color=#f0ba00]Wednesday:[/color][/td][td] '. $_POST['wed_start'] .' - '. $_POST['wed_finish'] .'[/td][/tr]
[tr][td][color=#f0ba00]Thursday:[/color][/td][td] '. $_POST['thu_start'] .' - '. $_POST['thu_finish'] .'[/td][/tr]
[tr][td][color=#f0ba00]Friday:[/color][/td][td] '. $_POST['fri_start'] .' - '. $_POST['fri_finish'] .'[/td][/tr]
[tr][td][color=#f0ba00]Saturday:[/color][/td][td] '. $_POST['sat_start'] .' - '. $_POST['sat_finish'] .'[/td][/tr]
[tr][td][color=#f0ba00]Sunday:[/color][/td][td] '. $_POST['sun_start'] .' - '. $_POST['sun_finish'] .'[/td][/tr]
[tr][td][color=#f0ba00][b]Other Information:[/b][/color][/td][/tr]
[tr][td][color=#f0ba00]Why do you want to join our Guild:[/color][/td][td]  ' . $_POST['why'] . '[/td][/tr]
[tr][td][color=#f0ba00]Do you know anyone in Fatal Fury:[/color][/td][td]   ' . $_POST['friend'] . '[/td][/tr]
[tr][td][color=#f0ba00]How did you find our site:[/color][/td][td] ' . $_POST['how'] . '[/td][/tr]
[tr][td][color=#f0ba00]How often do you visit our web site:[/color][/td][td] ' . $_POST['visit'] . '[/td][/tr]
[tr][td][color=#f0ba00]Other information:[/color][/td][td]   ' . $_POST['other'] .'[/td][/tr]
[/table]';



            if ($enable_email)
foreach($email_address as $email){
mail($email, $subject, $body,"From: " . $_POST['email']);
}


//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form
echo '
<form name="main" action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<tr class="windowbg"><th colspan=2>Personal Information</th></tr>
<TR class ="windowbg">
<TD width = "200px">* Your First Name:</TD>
<TD><INPUT id="First_name" name="First_name" type="text" value =""';
if (isset($_POST['First_Name'])) echo $_POST['First_name'];
echo '" /></TD>
</TR>
                        <TR class ="windowbg">
                                <TD width = "200px">* Your Last Name:</TD>
                                <TD><INPUT id="Last_name" name="Last_name" type="text" value =""';
if (isset($_POST['Last_Name'])) echo $_POST['Last_name'];
echo '" /></TD>
                        </TR>

<TR class ="windowbg">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
                                <TD width = "200px">* Age:</TD>
                                <TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];
echo '" /></TD>
                        </TR>
<TR class ="windowbg">
                                <TD width = "200px">Gender:
                                </TD>
                                <TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];
echo '" />
                                                <OPTION value="No Answer" selected>--------------------------</OPTION>
                                                <OPTION value="M">Male</OPTION>
                                                <OPTION value="F">Female</OPTION>
                                        </SELECT></TD>
                        </TR>
                        <TR class ="windowbg">
                                <TD width = "200px">Location:</TD>
                                <TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];
echo '" /></TD>
                        </TR>
<tr class="windowbg"><th colspan=2>Player Character Infromation</th></tr>
<TR class ="windowbg">
<TD width = "200px">* Name of Character applying:</TD>
<TD><INPUT id="cname" name="cname" type="text" value ="';
if (isset($_POST['cname'])) echo $_POST['cname'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
                                <TD width = "200px">Current Level:</TD>
                                <TD><select id="lvl" name="lvl" type="text" value ="';
if (isset($_POST['lvl'])) echo $_POST['lvl'];
echo '" />
                                <option value="No Answer">--</option>';
                        for($i=1; $i<71; $i++){
                                echo'
                                <option value="'. $i .'">'. $i .'</option>';
                        }
                        echo '
                        </TD>
                        </TR>
<tr class="windowbg">
<td>Previous Guilds:</td>
<td><input type="text" name="prev_clans" value="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];
echo '"></td>
</tr>
<tr class="windowbg">
<td>Race: </td>
<td><select name="Make" id="Make" onchange="fillSelectFromArray(this.form.clas, ((this.selectedIndex == -1) ? null : race[this.selectedIndex-1]));">
<option value="-1">Select Race</option>
<option value="1">Blood Elf</option>
<option value="2">Orc</option>
<option value="3">Tauren</option>
<option value="4">Troll</option>
<option value="5">Undead</option>
</select></td>
</tr>
<tr class="windowbg">
<td>Class:</td>
<td><select name="clas" size="6">
<option>                                  </option>
<option>                                  </option>
<option>                                  </option>
<option>                                  </option>
<option>                                  </option>
<option>                                  </option>
</select></td>
</tr>
<tr class="windowbg">
<td>List your attunments:</td>
<td><textarea name="attun" cols="20" rows="6">'; if (isset($_POST['attun'])) echo $_POST['attun'];
echo '</textarea></td>
</tr>
<TR class ="windowbg">
<TD width = "200px">Do you have raiding experience</TD>
<TD><SELECT id="raid_exp" name="raid_exp" style="WIDTH: 160px" value ="';
if (isset($_POST['raid_exp'])) echo $_POST['raid_exp'];   
echo '">
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Describe that experience:</TD>
<TD><textarea id="" name="raid_exp_disc" type="text" value ="';
if (isset($_POST['raid_exp_disc'])) echo $_POST['raid_exp_disc']; 
echo '" ></textarea></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">First Primary Profession:</TD>
<TD><SELECT id="profession_1_llv" name="profession_1_lvl" value ="';
if (isset($_POST['profession_1_lvl'])) echo $_POST['profession_1_lvl']; 
echo '">

<OPTION value="No answer" selected>---</OPTION>';
for($p1l=1; $p1l<376; $p1l++){
echo '<option value="'. $p1l .'">'. $p1l .'</option>';
}
echo '</SELECT>&nbsp;<select name="profession_1">
<option value="No Answer">--------------------------</option>
<option value="Alchemy">Alchemy</option>
<option value="Black Smith">Black Smith</option>
<option value="Enchanting">Enchanting</option>
<option value="Engineering">Engineering</option>
<option value="Herbalism">Herbalism</option>
<option value="Jewlcrafting">Jewlcrafting</option>
<option value="Leather Working">Leather Working</option>
<option value="Minning">Minning</option>
<option value="Skinner">Skinner</option>
<option value="Tailor">Tailor</option>
</select>
</TD>
</TR>
                                <TD class="windowbg" width = "200px">Second Primary Profession:</TD>
                                <TD class="windowbg"><SELECT id="profession_2_llv" name="profession_2_lvl" value ="';
if (isset($_POST['profession_2_lvl'])) echo $_POST['profession_2_lvl'];
echo '" />

                                                <OPTION value="No answer" selected>---</OPTION>';
                                        for($p2l=1; $p2l<376; $p2l++){
                                                echo '<option value="'. $p2l .'">'. $p2l .'</option>';
                                        }
                                        echo '</SELECT>&nbsp;<select name="profession_2">
                                                <option value="No Answer">--------------------------</option>
                                                <option value="Alchemy">Alchemy</option>
                                                <option value="Black Smith">Black Smith</option>
                                                <option value="Enchanting">Enchanting</option>
                                                <option value="Engineering">Engineering</option>
                                                <option value="Herbalism">Herbalism</option>
                                                <option value="Jewlcrafting">Jewlcrafting</option>
                                                <option value="Leather Working">Leather Working</option>
                                                <option value="Minning">Minning</option>
                                                <option value="Skinner">Skinner</option>
                                                <option value="Tailor">Tailor</option>
                                        </select>
                                </TD>
                        </TR>
<tr class="windowbg">
<td>Cooking Level:</td>
<td><SELECT id="cooking" name="cooking" value ="';
if (isset($_POST['cooking'])) echo $_POST['cooking'];
echo '" />

                                                <OPTION value="No answer" selected>---</OPTION>';
                                        for($cl=1; $cl<376; $cl++){
                                                echo '<option value="'. $cl .'">'. $cl .'</option>';
                                        }
                                        echo '</SELECT></td>
</tr>
                        <tr class="windowbg">
                                <td>First Aid Level:</td>
                                <td><SELECT id="first_aid" name="first_aid" value ="';
if (isset($_POST['first_aid'])) echo $_POST['first_aid'];
echo '" />

                                                <OPTION value="No answer" selected>---</OPTION>';
                                        for($fal=1; $fal<376; $fal++){
                                                echo '<option value="'. $fal .'">'. $fal .'</option>';
                                        }
                                        echo '</SELECT></td>
                        </tr>
                        <tr class="windowbg">
                                <td>Fishing Level:</td>
                                <td><SELECT id="fishing" name="fishing" value ="';
if (isset($_POST['fishing'])) echo $_POST['fishing'];
echo '" />

                                                <OPTION value="No answer" selected>---</OPTION>';
                                        for($fl=1; $fl<376; $fl++){
                                                echo '<option value="'. $fl .'">'. $fl .'</option>';
                                        }
                                        echo '</SELECT></td>
                        </tr>
<tr class="windowbg">
<th colspan="2">Ventrillo</td>
</tr>
<TR class ="windowbg">
<TD width = "200px">Do you have the ability to install and/or use Ventrilo?:</TD>
<TD><SELECT id="vent" name="vent" style="WIDTH: 160px" value ="';
if (isset($_POST['vent'])) echo $_POST['vent'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<tr class="windowbg">
<th colspan="2">Playing Times</th>
</tr>
<tr class="windowbg">
<td colspan="2">Please note that all times are server, and in 24 hour format.</td>
</tr>
<tr class="windowbg">
<td>Monday:</td>
<td><select name="mon_start">';
for($mst=0; $mst<24; $mst++){
echo '
<option value="'. $mst .':00">'. $mst .':00</option>
<option value="'. $mst .':30">'. $mst .':30</option>';
}
echo '</select> - <select name="mon_finish">';
                                for($mft=0; $mft<24; $mft++){
                                        echo '
                                        <option value="'. $mft .':00">'. $mft .':00</option>
                                        <option value="'. $mft .':30">'. $mft .':30</option>';
                                }
                                echo '</select></td>
</tr>
                        <tr class="windowbg">
                                <td>Tuesday:</td>
                                <td><select name="tue_start">';
                                for($tust=0; $tust<24; $tust++){
                                        echo '
                                        <option value="'. $tust .':00">'. $tust .':00</option>
                                        <option value="'. $tust .':30">'. $tust .':30</option>';
                                }
                                echo '</select> - <select name="tue_finish">';
                                for($tuft=0; $tuft<24; $tuft++){
                                        echo '
                                        <option value="'. $tuft .':00">'. $tuft .':00</option>
                                        <option value="'. $tuft .':30">'. $tuft .':30</option>';
                                }
                                echo '</select></td>
                        </tr>
                        <tr class="windowbg">
                                <td>Wednesday:</td>
                                <td><select name="wed_start">';
                                for($wst=0; $wst<24; $wst++){
                                        echo '
                                        <option value="'. $wst .':00">'. $wst .':00</option>
                                        <option value="'. $wst .':30">'. $wst .':30</option>';
                                }
                                echo '</select> - <select name="wed_finish">';
                                for($wft=0; $wft<24; $wft++){
                                        echo '
                                        <option value="'. $wft .':00">'. $wft .':00</option>
                                        <option value="'. $wft .':30">'. $wft .':30</option>';
                                }
                                echo '</select></td>
                        </tr>
                        <tr class="windowbg">
                                <td>Thursday:</td>
                                <td><select name="thu_start">';
                                for($thst=0; $thst<24; $thst++){
                                        echo '
                                        <option value="'. $thst .':00">'. $thst .':00</option>
                                        <option value="'. $thst .':30">'. $thst .':30</option>';
                                }
                                echo '</select> - <select name="thu_finish">';
                                for($thft=0; $thft<24; $thft++){
                                        echo '
                                        <option value="'. $thft .':00">'. $thft .':00</option>
                                        <option value="'. $thft .':30">'. $thft .':30</option>';
                                }
                                echo '</select></td>
                        </tr>
                        <tr class="windowbg">
                                <td>Friday:</td>
                                <td><select name="fri_start">';
                                for($fst=0; $fst<24; $fst++){
                                        echo '
                                        <option value="'. $fst .':00">'. $fst .':00</option>
                                        <option value="'. $fst .':30">'. $fst .':30</option>';
                                }
                                echo '</select> - <select name="fri_finish">';
                                for($fft=0; $fft<24; $fft++){
                                        echo '
                                        <option value="'. $fft .':00">'. $fft .':00</option>
                                        <option value="'. $fft .':30">'. $fft .':30</option>';
                                }
                                echo '</select></td>
                        </tr>
                        <tr class="windowbg">
                                <td>Saturday:</td>
                                <td><select name="sat_start">';
                                for($sast=0; $sast<24; $sast++){
                                        echo '
                                        <option value="'. $sast .':00">'. $sast .':00</option>
                                        <option value="'. $sast .':30">'. $sast .':30</option>';
                                }
                                echo '</select> - <select name="sat_finish">';
                                for($saft=0; $saft<24; $saft++){
                                        echo '
                                        <option value="'. $saft .':00">'. $saft .':00</option>
                                        <option value="'. $saft .':30">'. $saft .':30</option>';
                                }
                                echo '</select></td>
                        </tr>
                        <tr class="windowbg">
                                <td>Sunday:</td>
                                <td><select name="sun_start">';
                                for($sust=0; $sust<24; $sust++){
                                        echo '
                                        <option value="'. $sust .':00">'. $sust .':00</option>
                                        <option value="'. $sust .':30">'. $sust .':30</option>';
                                }
                                echo '</select> - <select name="sun_finish">';
                                for($suft=0; $suft<24; $suft++){
                                        echo '
                                        <option value="'. $suft .':00">'. $suft .':00</option>
                                        <option value="'. $suft .':30">'. $suft .':30</option>';
                                }
                                echo '</select></td>
                        </tr>

<tr class="windowbg">
<th colspan="2">Other Information</th>
</td>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Fatal Fury</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you know anyone in Fatal Fury:
</TD>
<TD><TEXTAREA id="friend" name="friend" rows="4" cols="40" value ="';
if (isset($_POST['friend'])) echo $_POST['freind'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<tr class="windowbg">
<td>How did you find our site?:</td>
<td><select name="how">
<option value="No Answer">-------------------</option>
<option value="search">Search Engine (google, etc)</option>
<option value="friend">Friend reccomended</option>
<option value="other method">Other</option
</select></td>
</tr>
<tr class="windowbg">
<td>How often do you visit our site?:</td>
<td><select name="visit">
<option value="First Visit">First Visit</option>
<option value="Daily">Daily</option>
<option value="weekly">Weekly</option>
<option value="monthly">Montly</option>
<option value="yearly">Yearly</option>
</select></td>
</tr>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>
';
?>


Note that I added a requirement for the applicant to have a valid user account to even see the application.
Note the e-mail portion is now an array.
Note the addition of java script for the race and class.

here is the java script that I used:

race = new Array(
new Array(
new Array("Hunter", "Hunter"),
new Array("Mage", "Mage"),
new Array("Paladin", "Paladin"),
new Array("Priest", "Priest"),
new Array("Rogue", "Rogue"),
new Array("Warlock", "Warlock")
),
new Array(
new Array("Hunter", "Hunter"),
new Array("Rogue", "Rogue"),
new Array("Shaman", "Shaman"),
new Array("Warrior", "Warrior"),
new Array("Warlock", "Warlock")
),
new Array(
new Array("Druid", "Druid"),
new Array("Hunter", "Hunter"),
new Array("Shaman", "Shaman"),
new Array("Warrior", "Warrior")
),
new Array(
new Array("Hunter", "Hunter"),
new Array("Mage", "Mage"),
new Array("Priest", "Priest"),
new Array("Rogue", "Rogue"),
new Array("Shaman", "Shaman"),
new Array("Warrior", "Warrior")
),
new Array(
new Array("Mage", "Mage"),
new Array("Priest", "Priest"),
new Array("Rogue", "Rogue"),
new Array("Warrior", "Warrior"),
new Array("Warlock", "Warlock")
)
);
function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
// empty existing items
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[i][1];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
   }
}

Note that this is a separate file which I put in it's own directory "Dropdown/dropdown.js"

and in your "Themes/{currenttheme}/index.template.php" file you will need to add the location of that dropdown JS between the <head> and the </head>


<script type="text/javascript" src="Dropdown/dropdown.js"></script>
Title: Re: [Done!] Join Us! form
Post by: CampCounselor on February 21, 2008, 03:28:39 PM
I am getting problems.
Quote
Parse error: syntax error, unexpected T_GLOBAL in C:\xampp\htdocs\ACE\dropdown.php on line 4
Title: Re: [Done!] Join Us! form
Post by: tc3driver on February 21, 2008, 09:34:33 PM
if you are trying to implement the Dropdown Java Script (I cannot tell but am guessing that you are).

That should be named "dropdown.js" by giving it a php extension your server is trying to parse it as php, and it is not php it is java script.
Title: Re: [Done!] Join Us! form
Post by: CampCounselor on February 22, 2008, 01:29:10 AM
i put the code in for the article in a php file. and in the article i put in

include("dropdown.php");
Title: Re: [Done!] Join Us! form
Post by: tc3driver on February 22, 2008, 08:27:04 PM
the only thing I can think of, because I just copy and paste the entire thing into the article minus the <? at the begening and the ?> at the end, is that it doesn't like to have the global in an inculde. try something like this:

remove the global statement global $sourcedir, $user_info, $context; from the "dropdown.php".

and make your article look like this

global $sourcedir, $user_info, $context;
include("dropdown.php");


grasping at straws, but a guess.
Title: Re: [Done!] Join Us! form
Post by: RSprinkel on February 23, 2008, 07:13:32 PM
Hi all,

Great little script thanks to all the contributors of this.

Quick question though.  How would I go about putting text above the actual form?  I tried adding text to it, but was getting all types of errors and I messed with it for a few hours and gave up.

Thanks much in advance for any help and again thanks for all the work on this script. ;)

Ron S.
Title: Re: [Done!] Join Us! form
Post by: TimUSA on February 23, 2008, 07:23:06 PM
This would be the easiest way


echo'
<p>Your Text Here</p>';
Title: Re: [Done!] Join Us! form
Post by: RSprinkel on February 23, 2008, 07:38:34 PM
Ahhh ok, I was putting it under the first echo section but didn't have the '; at the end.

Thanks much for the info TimUSA. ;)
Title: Re: [Done!] Join Us! form
Post by: RSprinkel on March 16, 2008, 10:14:04 PM
Hello all,

Have another question.  When we approve a member of the forum we would like to have certain information placed from the Join Us form in a Welcome Area in our Forums, can this be easily implemented into this script?


THanks much in advance for any help on this.
Title: Re: [Done!] Join Us! form
Post by: Hairy on March 16, 2008, 10:45:32 PM
I would say you could get it post post in both sections at the same time but you will have to copy-paste the info or move the topic into the welcome section if it's going to be done at a different time. 
Title: Re: [Done!] Join Us! form
Post by: revscott on March 19, 2008, 04:38:27 AM
Hey everyone,   First and foremost, thank you to all that have contributed to this script!! 

I love this script however my php skill need much improvement. 
I'm trying to work this script into a site I have been working on however I seemed to have reached a road block,  Using what I have learned here on this thread and on the other sections of the site, 
I thought I had the required knowledge to do a little modification on this. (I just changed around the items and put in a few new ones) but I ended up with a Parse Error I do not understand,

QuoteParse error: parse error, unexpected T_STRING in /html/dark/Sources/Load.php(1749) : eval()'d code(209) : eval()'d code on line 119

Here is the I code I have been trying to work with,  If I could get a fresh set of eye to peek at this I would be very thankful,  I have been playing around with this code for about 6 hours now and just can't get it right.

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');

// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment admins
$email_address='rev.scott@verizon.net';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=6.0;

//the id of the this article
$this_article_id = '17';

//article to be redirected when form is submitted
$thank_you_article_id = '9';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}   
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Game you are applying for:  ' . $_POST['game'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Time Zone:  ' . $_POST['timezone'] . '
Regular time of day you play:   ' . $_POST['regtod'] . '
Number of days during the week that you play:   ' . $_POST['numdays'] . '
Will you be able to attend Practice, Matches, & Wars?:  ' . $_POST['ts'] . '
User ID's (Please all that apply.  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag/User Name):  ' . $_POST['userids'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Do you have a headset?:  ' . $_POST['mic'] . '
Why do you want to join our clan?:  ' . $_POST['why'] . '
Do you posses any web design, graphics or other skill that could be contributed to the clan?: ' . $_POST['webskill'] . '
Recruited by a Dark Asylum Member?: ' . $_POST['damember'] . '
Dark Asylum member's name:  ' . $_POST['daname'] . '
What game systems do you have?:   ' . $_POST['systems'] . '
What other games do you play?:   ' . $_POST['othergames'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />

[B]Real Name:[/B]  ' . $_POST['real_name'] . '
[B]Email address:[/B]  ' . $_POST['email'] . '
[B]Game you are applying for: [/B]  ' . $_POST['game'] . '
[B]Age:[/B] ' . $_POST['age'] . '
[B]Gender:[/B] ' . $_POST['gender'] . '
[B]Location:[/B] ' . $_POST['location'] . '
[B]Time Zone:[/B] ' . $_POST['timezone'] . '
[B]Regular time of day you play:[/B] ' . $_POST['regtod'] . '
[B]Number of days during the week that you play:[/B] ' . $_POST['numdays'] . '
[B]Will you be able to attend Practice, Matches, & Wars?:[/B] ' . $_POST['ts'] . '
[B]User ID's (Please all that apply.  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag/User Name):[/B] ' . $_POST['userids'] . '
[B]Previous clan(s):[/B] ' . $_POST['prev_clans'] . '
[B]Do you have a headset?:[/B] ' . $_POST['mic'] . '
[B]Why do you want to join our clan?:[/B] ' . $_POST['why'] . '
[B]Do you posses any web design, graphics or other skill that could be contributed to the clan?:[/B] ' . $_POST['webskill'] . '
[B]Recruited by a Dark Asylum Member?:[/B] ' . $_POST['damember'] . '
[B]Dark Asylum Member's name:[/B] ' . $_POST['daname'] . '
[B]What game systems do you have?:[/B] ' . $_POST['systems'] . '
[B]What other games do you play?:[/B] ' . $_POST['othergames'] . '
[B]Other information:[/B] ' . $_POST['other']. '';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
<INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">

<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Game you are applying for:</TD>
<TD><SELECT id = "game" name = "game" style="WIDTH: 152px" value ="';
if (isset($_POST['game'])) echo $_POST['game'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Socom">Socom</OPTION>
<OPTION value="Call of Duty">Call of Duty</OPTION>
<OPTION value="Both">Both</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Gender:</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Time Zone:</TD>
<TD><INPUT id="timezone" name="timezone" type="text" value ="';
if (isset($_POST['timezone'])) echo $_POST['timezone'];   
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Regular Time of Day You Play.</TD>
<TD><SELECT id="regtod" name="regtod" style="WIDTH: 160px" value ="';
if (isset($_POST['regtod'])) echo $_POST['regtod'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="morning">Morning</OPTION>
<OPTION value="afternoon">Afternoon</OPTION>
<OPTION value="evening">Evening</OPTION>
<OPTION value="latenight">Late Night</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Number of days During the week that you play:</TD>
<TD><SELECT id="numdays" name="numdays" style="WIDTH: 160px" value ="';
if (isset($_POST['numdays'])) echo $_POST['numdays'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="1">1</OPTION>
<OPTION value="2">2</OPTION>
<OPTION value="3">3</OPTION>
<OPTION value="4">4</OPTION>
<OPTION value="5">5</OPTION>
<OPTION value="6">6</OPTION>
<OPTION value="7">7</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Will you be able to attend Practice, Matches & Wars?</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
<OPTION value="I will try my best">I will try my best</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">User ID's (Please identify all that apply.  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag/User Name):</TD>
<TD><TEXTAREA id ="userids" name ="userids" rows="4" cols="40"  value ="';
if (isset($_POST['userids'])) echo $_POST['userids'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Do you have headset?:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Why do you want to join?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Do you posses any web design, graphics or other skill that could be contributed to the clan?:</TD>
<TD><SELECT id="webskill" name="webskill" style="WIDTH: 160px" value ="';
if (isset($_POST['webskill'])) echo $_POST['webskill'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="web">Yes Web Design</OPTION>
<OPTION value="graphics">Yes Graphics</OPTION>
<OPTION value="no">No</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Recruited by a Dark Asylum Member?</TD>
<TD><SELECT id="damember" name="damember" style="WIDTH: 160px" value ="';
if (isset($_POST['damember'])) echo $_POST['damember'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Dark Asylum members name:</TD>
<TD><INPUT id="daname" name="daname" type="text" value ="';
if (isset($_POST['daname'])) echo $_POST['daname']; 
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">What gaming systems do you have?:</TD>
<TD><TEXTAREA id="systems" name="systems" rows="4" cols="40" value ="';
if (isset($_POST['systems'])) echo $_POST['systems'];
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">What other games do you play?:</TD>
<TD><TEXTAREA id="othergames" name="othergames" rows="4" cols="40" value ="';
if (isset($_POST['othergames'])) echo $_POST['othergames'];
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';


Thanks in advance for any help you all could send my way!  -Scott
Title: Re: [Done!] Join Us! form
Post by: IchBin on March 19, 2008, 05:49:41 AM
Change this line:
<TD width = "200px">User ID's (Please identify all that apply.  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag/User Name):</TD>

To this:
<TD width = "200px">User ID\'s (Please identify all that apply.  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag/User Name):</TD>
Title: Re: [Done!] Join Us! form
Post by: revscott on March 19, 2008, 01:00:01 PM
I can't thank you enough,  That was just what I needed, 
I had a few more of those "Apostrophe Errors" in the script and was able to correct them. Now running smooth, Thank you very much IchBin
Title: Re: [Done!] Join Us! form
Post by: revscott on March 19, 2008, 01:49:21 PM
ok,  I have corrected all the errors I had and now the script successfully loads however it when the questions are answered and the page is submitted it will not post in the forum and it will not send an email (Plus it redirects to the wrong page)
I figured the problem may be in the fact that I do not have this installed in the sites root, but I can't imagine that this would stop the email from going through.

Here is a fresh look at the code I have corrected.  Any suggestions?

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment admins
$email_address='rev.scott@verizon.net';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=6.0;

//the id of the this article
$this_article_id = '19';

//article to be redirected when form is submitted
$thank_you_article_id = '20';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}   
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Game you are applying for:  ' . $_POST['game'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Time Zone:  ' . $_POST['timezone'] . '
Regular time of day you play:   ' . $_POST['regtod'] . '
Number of days during the week that you play:   ' . $_POST['numdays'] . '
Will you be able to attend Practice, Matches, & Wars?:  ' . $_POST['ts'] . '
User ID(s) (Please all that apply.  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag/User Name):  ' . $_POST['userids'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Do you have a headset?:  ' . $_POST['mic'] . '
Why do you want to join our clan?:  ' . $_POST['why'] . '
Do you posses any web design, graphics or other skill that could be contributed to the clan?: ' . $_POST['webskill'] . '
Recruited by a Dark Asylum Member?: ' . $_POST['damember'] . '
Dark Asylum member\'s name:  ' . $_POST['daname'] . '
What game systems do you have?:   ' . $_POST['systems'] . '
What other games do you play?:   ' . $_POST['othergames'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />

[B]Real Name:[/B]  ' . $_POST['real_name'] . '
[B]Email address:[/B]  ' . $_POST['email'] . '
[B]Game you are applying for: [/B]  ' . $_POST['game'] . '
[B]Age:[/B] ' . $_POST['age'] . '
[B]Gender:[/B] ' . $_POST['gender'] . '
[B]Location:[/B] ' . $_POST['location'] . '
[B]Time Zone:[/B] ' . $_POST['timezone'] . '
[B]Regular time of day you play:[/B] ' . $_POST['regtod'] . '
[B]Number of days during the week that you play:[/B] ' . $_POST['numdays'] . '
[B]Will you be able to attend Practice, Matches, & Wars?:[/B] ' . $_POST['ts'] . '
[B]User ID(s) (Please all that apply.  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag/User Name):[/B] ' . $_POST['userids'] . '
[B]Previous clan(s):[/B] ' . $_POST['prev_clans'] . '
[B]Do you have a headset?:[/B] ' . $_POST['mic'] . '
[B]Why do you want to join our clan?:[/B] ' . $_POST['why'] . '
[B]Do you posses any web design, graphics or other skill that could be contributed to the clan?:[/B] ' . $_POST['webskill'] . '
[B]Recruited by a Dark Asylum Member?:[/B] ' . $_POST['damember'] . '
[B]Dark Asylum Member\'s name:[/B] ' . $_POST['daname'] . '
[B]What game systems do you have?:[/B] ' . $_POST['systems'] . '
[B]What other games do you play?:[/B] ' . $_POST['othergames'] . '
[B]Other information:[/B] ' . $_POST['other']. '';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
<INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">

<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Game you are applying for:</TD>
<TD><SELECT id = "game" name = "game" style="WIDTH: 152px" value ="';
if (isset($_POST['game'])) echo $_POST['game'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Socom">Socom</OPTION>
<OPTION value="Call of Duty">Call of Duty</OPTION>
<OPTION value="Both">Both</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Gender:</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Time Zone:</TD>
<TD><INPUT id="timezone" name="timezone" type="text" value ="';
if (isset($_POST['timezone'])) echo $_POST['timezone'];   
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Regular time of day you play:</TD>
<TD><SELECT id="regtod" name="regtod" style="WIDTH: 160px" value ="';
if (isset($_POST['regtod'])) echo $_POST['regtod'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="morning">Morning</OPTION>
<OPTION value="afternoon">Afternoon</OPTION>
<OPTION value="evening">Evening</OPTION>
<OPTION value="latenight">Late Night</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Number of days during the week that you play:</TD>
<TD><SELECT id="numdays" name="numdays" style="WIDTH: 160px" value ="';
if (isset($_POST['numdays'])) echo $_POST['numdays'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="1">1</OPTION>
<OPTION value="2">2</OPTION>
<OPTION value="3">3</OPTION>
<OPTION value="4">4</OPTION>
<OPTION value="5">5</OPTION>
<OPTION value="6">6</OPTION>
<OPTION value="7">7</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Will you be able to attend Practice, Matches and Wars?</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
<OPTION value="I will try my best">I will try my best</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">User ID(s) (Please identify all that apply:  Socom, Call Of Duty, PS3 ID & Xbox Gamer Tag or User Name):</TD>
<TD><TEXTAREA id ="userids" name ="userids" rows="4" cols="40"  value ="';
if (isset($_POST['userids'])) echo $_POST['userids'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Do you have headset?:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Why do you want to join?:</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Do you posses any web design, graphics or other skill that could be contributed to the clan?:</TD>
<TD><SELECT id="webskill" name="webskill" style="WIDTH: 160px" value ="';
if (isset($_POST['webskill'])) echo $_POST['webskill'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="web">Yes Web Design</OPTION>
<OPTION value="graphics">Yes Graphics</OPTION>
<OPTION value="no">No</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Recruited by a Dark Asylum member?:</TD>
<TD><SELECT id="damember" name="damember" style="WIDTH: 160px" value ="';
if (isset($_POST['damember'])) echo $_POST['damember'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Dark Asylum member\'s name:</TD>
<TD><INPUT id="daname" name="daname" type="text" value ="';
if (isset($_POST['daname'])) echo $_POST['daname']; 
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">What gaming systems do you have?:</TD>
<TD><TEXTAREA id="systems" name="systems" rows="4" cols="40" value ="';
if (isset($_POST['systems'])) echo $_POST['systems'];
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">What other games do you play?:</TD>
<TD><TEXTAREA id="othergames" name="othergames" rows="4" cols="40" value ="';
if (isset($_POST['othergames'])) echo $_POST['othergames'];
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>

<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
  I really appreciate the help.
Title: Re: [Done!] Join Us! form
Post by: Hairy on March 19, 2008, 02:41:11 PM
First thing I notice, you need to add a } at the end to close it off, also for directing to the thank-you/error articles you need to need to do 2 changes, this is because you said you don't have SMF installed in your root directory.

http://www.tinyportal.net/index.php?topic=9840.msg175873#msg175873 should hrlp you work out the changes, instead of "forum" use the name of the folder SMF is in (case-sensitive)

Might be more fixes needed, see how that goes first.
Title: Re: [Done!] Join Us! form
Post by: revscott on March 19, 2008, 04:18:32 PM
Thanks for the Help Hairy.
Ok,  I made the changes to the directories (Both of them) but I am a little unclear about the  }  Where is that missing,  at the very end of the script, or the end of the error/thank you?
If you could show me the line it should be on, after looking around I just couldn't find the spot it belonged.
Title: Re: [Done!] Join Us! form
Post by: Hairy on March 19, 2008, 09:46:36 PM
Oh, sorry about that, my form only needed it because I had added the "if user is guest show error and ask them to register" condition and that's why I had that.

I'll test it and see if I can get it working when I'm home (12 hours from now) unless someone can see the problem before then  :up:
Title: Re: [Done!] Join Us! form
Post by: revscott on March 20, 2008, 04:49:52 AM
Thank you for any help you can offer!   Hope you enjoy work.
Title: Re: [Done!] Join Us! form
Post by: forty4420 on March 22, 2008, 10:29:50 AM
Is it just me or does this only work in a block?

I have tried it in both block & in an artical & it will only seem to send (work) when its a block..

Any ideas?
Title: Re: [Done!] Join Us! form
Post by: Hairy on March 24, 2008, 07:57:27 AM
I tested this out and tried some changes but no luck, sorry I can't easily see what's causing an issue  :idiot2:
Title: Re: [Done!] Join Us! form
Post by: IchBin on March 24, 2008, 02:22:52 PM
Are you guys changing the article id referenced in the code?
Title: Re: [Done!] Join Us! form
Post by: forty4420 on March 24, 2008, 02:33:48 PM
I didn't make any changes to mine except to the forms etc...



global $sourcedir, $user_info, $context, $stack;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of reqruitment staf member
$email_address='recruitement@your-clan.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2.0;

//the id of the this article
$this_article_id = '888888';

//article to be redirected when form is submitted
$thank_you_board_id = '2.0';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Steam ID:  ' . $_POST['honor'] . '
Previous Unit(s):  ' . $_POST['prev_clans'] . '
Realism Experience:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'</br>
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>*Steam ID: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous Unit(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Realism Experience: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Ventrilo installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>I have read "ALL" Enlistment Office material [Recruit Handbook] mandatory for all recruits.<td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: '.$scripturl.'?board=' . $thank_you_board_id);

} else {
// Redirect to error page
//header('Location: '.$scripturl.'?board=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="/index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Steam ID:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous Unit(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Realism Experience (give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join [2nd ID]</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">I have read "ALL" Enlistment Office material <A HREF="http://www.secondinfantry.net/index.php?board=3.0"><FONT COLOR="#FF0000">[Recruit Handbook]</FONT></A> mandatory for all recruits.</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';


Title: Re: [Done!] Join Us! form
Post by: IchBin on March 24, 2008, 03:35:41 PM
There's no reason to post the code here. However, you need to follow the directions in the configuration section or its not going to work.

// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of reqruitment staf member
$email_address='recruitement@your-clan.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=2.0;

//the id of the this article
$this_article_id = '888888';

//article to be redirected when form is submitted
$thank_you_board_id = '2.0';


//END OF CONFIGURATION SECTION
Title: Re: [Done!] Join Us! form
Post by: lOOmis on March 25, 2008, 03:30:05 AM
I've read through this topic several times and have not found what I was looking for. One person touched on it, about where the form article will be located. If I read correctly Im to make a board, get the ID of that board and put in place of the board_id=?
//board id to which the application should be posted
$board_id=3.0;

//the id of the this article
$this_article_id = '17';

//article to be redirected when form is submitted
$thank_you_article_id = '9';

Am I to do this with each article? As it stands the article is not showing up. It seems easy enough if I'm reading this correctly, but that may be the reason its not working. Sorry if this question is pre-school but any guidance would be much appreciated.
Title: Re: [Done!] Join Us! form
Post by: trench on March 25, 2008, 11:44:00 AM
yeah, replace the ID with the forum you want the contact info to go to.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 25, 2008, 12:37:45 PM
What do you mean by "the article is not showing up"?
Title: Re: [Done!] Join Us! form
Post by: lOOmis on March 25, 2008, 03:19:13 PM
My article that I created for this Join Us code. It shows fine on the front page when I have it enabled to do so. But when I change it to NOT show on front page but keep it active, change the id to the board id in the code(ex. Interested in Joining Us board_id is 3.0) it just shows the actual topic in the board but no Join Us Form. Does this make any sense?

Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 25, 2008, 04:16:34 PM
Maybe it makes sense. Where do you want the article to show up? It is not designed to appear on a post in your forum. It's an article. If you don't have it appear on your front page, you'll need to create a link to it. Go into your article manager and hover over the name of the article to find out the number of the article or check out what query title you gave to the article. Let's say it's article 43. Then your link to it would be index.php?page=43 or, if your query title is "joinform" the link would be index.php?page=joinform.

The board number in the code is that you can have the results of the form added into a post on a particular board.

If nothing that I wrote above applies to you, then I still didn't understand what you were saying and maybe we need to figure out another way for you to explain it.
Title: Re: [Done!] Join Us! form
Post by: lOOmis on March 25, 2008, 04:29:47 PM
JPDeni that is exactly the info I'm looking for, should help a lot.
Thank You for your assistance. I'm fairly certain it wont be the last time.

lOOmis
Title: Re: [Done!] Join Us! form
Post by: iGate on April 17, 2008, 12:56:33 PM
hey all.

how can i limit the use of this form to only those logged in.
and those who aren't logged in are given the option to login or register

thx
Title: Re: [Done!] Join Us! form
Post by: IchBin on April 17, 2008, 09:35:45 PM
Yes, you just don't show the information to guests. Its a feature in the article categories and blocks.
Title: Re: [Done!] Join Us! form
Post by: iGate on April 18, 2008, 11:02:27 AM
Quote from: IchBinâ,,¢ on April 17, 2008, 09:35:45 PM
Yes, you just don't show the information to guests. Its a feature in the article categories and blocks.

sry, im not sure how to do that with articles. can u explain?
Title: Re: [Done!] Join Us! form
Post by: IchBin on April 18, 2008, 09:01:36 PM
For the category you uncheck guests so that they can't see the articles in that category.
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on April 26, 2008, 03:40:58 PM
Great script here.

I am seeking some assistance on something.  I am using this as a Driver Application for my racing league.  I need to have in one of the sections that has to be entered a list of Car Numbers taken.  I have created a db to hold the numbers and such and created a php script that would pull the info out of the db.

What I need is to display just the car numbers that are entered into the db in the section of the application where a new member has to enter their car number.

Example
Car/Truck Number: Numbers Taken go here Then the box to enter their info.

I have the following code, but it seems that it is not liked for some reason:
<TR class ="windowbg">
<TD width = "200px">Car/Truck Number: Please make sure it is available</TD>
<TD><INPUT id="number" name="number" type="text" value ="<b>
      <font color="#000000"><br>Car Numbers Taken<?php
include /numbers/taken.php ?>
</a></font></b>';


Thanks much for your help  ;)
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 26, 2008, 04:00:04 PM
Quote
but it seems that it is not liked for some reason

How is the "not liking" manifested? What happens?
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on April 26, 2008, 06:07:41 PM
Well it is kicking out errors:  here is the latest one:

QuoteParse error: syntax error, unexpected '>' in /home/mysite/public_html/Sources/Load.php(1789) : eval()'d code(246) : eval()'d code on line 265

From Lines 263 - 269 are this:
<TR class ="windowbg">
<TD width = "200px">Car/Truck Number: Please make sure it is available</TD>
<TD><INPUT id="number" name="number" type="text" value ="'<b>
      <font color="#000000"><br>Car Numbers Taken<?php
include /numbers/taken.php ?>
</a></font></b>;
if (isset($_POST['number'])) echo $_POST['number'];   
echo '" /></TD>


Line 265 is:
<TD><INPUT id="number" name="number" type="text" value ="'<b>
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 26, 2008, 06:52:03 PM
The line numbers aren't accurate. The only thing they tell you is that the error is either on that line or some previous line. Could be 10, 20 or even 100 lines above.

I can't tell whether what you've posted is html or php from what you have posted. I can be pretty sure that the input field is wrong.

Try posting the whole code.
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on April 26, 2008, 06:57:00 PM
Hi JPDeni,

Thanks for the help.

Well the artilce is set as PHP but here is the code.  Also note the little added info came from a php script as well.

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='admin@cs-racin.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=10.0;

//the id of the this article
$this_article_id = '7';

//article to be redirected when form is submitted
$thank_you_article_id = '6';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an Series
if (empty($_POST['series']) ){
$enroll_errors[] = 'You forgot to tell us what series you are running.';
}
// Check for an Sierra name
if (empty($_POST['sierra_name']) ){
$enroll_errors[] = 'You forgot to enter your Sierra Nickname.';
}   
// Check for an ARCA name
if (empty($_POST['arca_name']) ){
$enroll_errors[] = 'You forgot to enter your Arca Nickname.';
}
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}
// Check for an Rules
if (empty($_POST['rules']) ){
$enroll_errors[] = 'You forgot to tell us if you read the rules.';
}

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Driver Application';
$body = 'Driver application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Series:  ' . $_POST['series'] . '
Sierra Name:  ' . $_POST['sierra_name'] . '
Arca Name:  ' . $_POST['arca_name'] . '
Car/Truck Number:  ' . $_POST['number'] . '
Level of Racing Experience:  ' . $_POST['experience'] . '
Racing History:   ' . $_POST['history'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our League?  ' . $_POST['why'] . '
Other information:  ' . $_POST['other'].'
Rules:  ' . $_POST['rules'];


$postbody = 'Driver application has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Real Name:[/td][td]  ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td]  ' . $_POST['email'] . '[/td][/tr]
[tr][td]Age:[/td][td]  ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender: [/td][td]' . $_POST['gender'] . '[/td][/tr]
[tr][td]Location:[/td][td]  ' . $_POST['location'] . '[/td][/tr]
[tr][td]Series:[/td][td]  ' . $_POST['series'] . '[/td][/tr]
[tr][td]Current Sierra Name:[/td][td]  ' . $_POST['sierra_name'] . '[/td][/tr]
[tr][td]Current Arca Name:[/td][td]  ' . $_POST['arca_name'] . '[/td][/tr]
[tr][td]Car/Truck Number:[/td][td]  ' . $_POST['number'] . '[/td][/tr]
[tr][td]Level of Racing Experience:[/td][td]  ' . $_POST['experience'] . '[/td][/tr]
[tr][td]Racing History: [/td][td] ' . $_POST['history'] . '[/td][/tr]
[tr][td]TeamSpeak installed?: [/td][td] ' . $_POST['ts'] . '[/td][/tr]
[tr][td]Have microphone/headset: [/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Would like to help pay for a server?:[/td][td] ' . $_POST['pay'] . '[/td][/tr]
[tr][td]Why do you want to join our League? [/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Other information: [/td][td] ' . $_POST['other']. '[/td][/tr]
[tr][td]Rules: [/td][td] ' . $_POST['rules']. '[/td][/tr]
[/table]';


            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form
echo'
<p align="center"><b><font face="Comic Sans MS" color="#FF0000" size="5">Welcome
to Championship Sim Racin League</font></b></p>
<p align="center"><b><font face="Comic Sans MS" color="#00FFFF">We are glad you
are showing interest in CSRL by filling out this application.  </font></b>
</p>
<p align="center"><b><font face="Comic Sans MS" color="#00FFFF">Please note that
you </font><font face="Comic Sans MS" color="#FF0000">MUST</font><font face="Comic Sans MS" color="#00FFFF">
Fill this application out fully and make sure you read the League Rules before
submitting.  Failure to fill in all spaces will cause your application to
be put on hold until one of our Admins make contact with you concerning the
information not filled in.  </font></b></p>
<p align="center"><b><font face="Comic Sans MS" color="#00FFFF">If you do not
Read the League Rules you will be held accountable for you actions on the track
as well as in the Forums.  </font></b></p>
<p align="center"> </p>
<p align="center"><b><font face="Comic Sans MS" color="#00FFFF">As of May 1st,
2008 all new applicants will have to start in the Rookie Series and will not be
able to run the Pro Series until the following:</font></b></p>
<p align="center"><font face="Comic Sans MS" color="#FFFF00">All new drivers
will be placed in the Rookie Series upon acceptance to CSRL. They will race
there for 4 weeks. After that, those drivers deemed qualified will be promoted
to the Pro Series on a provisional basis for another 4 weeks of evaluation.
During this provisional period, drivers may be subject to demotion to the Rookie
Series for another 4-week period. This Pro Series provisional period is designed
to see how a new driver reacts to larger fields and better drivers.</font><br>
</p>

';
echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Which Series do you want to Run?</TD>
<TD><SELECT id="series" name="series" style="WIDTH: 160px" value ="';
if (isset($_POST['series'])) echo $_POST['series'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="N2K3">N2K3</OPTION>
<OPTION value="Arca">Arca</OPTION>
<OPTION value="Both">Both</OPTION>
</SELECT></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">* Current Sierra Name:</TD>
<TD><INPUT id="sierra_name" name="sierra_name" type="text" value ="';
if (isset($_POST['sierra_name'])) echo $_POST['sierra_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current Arca Name:</TD>
<TD><INPUT id="arca_name" name="arca_name" type="text" value ="';
if (isset($_POST['arca_name'])) echo $_POST['arca_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Car/Truck Number: Please make sure it is available</TD>
<TD><INPUT id="number" name="number" type="text" value ="'<b>
      <font color="#000000"><br>Car Numbers Taken<?php
include /numbers/taken.php ?>
</a></font></b>;
if (isset($_POST['number'])) echo $_POST['number'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Level of Racing Experience?</TD>
<TD><SELECT id="experience" name="experience" style="WIDTH: 160px" value ="';
if (isset($_POST['experience'])) echo $_POST['experience'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="0-6mos">0-6mos</OPTION>
<OPTION value="6mos - 1year">6mos - 1year</OPTION>
<OPTION value="1year - 3years">1year - 3years</OPTION>
<OPTION value="3+ Years">3+ Years</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Racing History:</TD>
<TD><TEXTAREA id="history" name="history" rows="4" cols="40" value ="';
if (isset($_POST['history'])) echo $_POST['history'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have TeamSpeak installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join Championship Sim Racin League?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Did you read the Rules?:</TD>
<TD><SELECT id="rules" name="rules" style="WIDTH: 160px" value ="';
if (isset($_POST['rules'])) echo $_POST['rules'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on April 26, 2008, 07:00:22 PM
It worked fine before I added the:
<b>
      <font color="#000000"><br>Car Numbers Taken<?php
include /numbers/taken.php ?>
</a></font></b>


In the original code, but there was no way of checking what car numbers were actually available unless they left the application, visited the forums or whatever.

With this code it would be able to display the numbers already taken right there on the application.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 26, 2008, 07:16:41 PM
Now I see what you did. This will not work, for several reasons.

Change this:


echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Car/Truck Number: Please make sure it is available</TD>
<TD><INPUT id="number" name="number" type="text" value ="'<b>
      <font color="#000000"><br>Car Numbers Taken<?php
include /numbers/taken.php ?>
</a></font></b>;


to this


echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Car/Truck Number: Please make sure it is available</TD>
<TD><INPUT id="number" name="number" type="text" value ="';
include '/numbers/taken.php';



I don't know that the program will actually do what you want it to, but this should take care of your syntax errors.
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on April 26, 2008, 07:33:21 PM
Yup got rid of the errors, but like you mentioned it didn't do what I want it to do.  since this is saved as a PHP Page basically, is there a way to do this? 
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 26, 2008, 08:02:03 PM
I would have to know what's in the code in "taken.php." That might tell me what you are trying to accomplish, but I'm not sure. Can you explain exactly what you want to do?
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on April 26, 2008, 08:17:16 PM
Ok what I have done was create a database.  The car number that is chosen by the new applicant is placed into this database as taken once the application has been submitted.  The taken.php script basically is supposed to pull the car numbers listed in that database and posted on this application so it isn't chosen again.  Next to the entry box for the question asked what car number do you want to use.

Here is the code from the taken.php script:

<?
include 'db.php';

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Car Numbers Taken</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
table{font-family: Verdana; color: #cc9933}
-->
</style>
</head>
<body bgcolor="#C0C0C0">

<div align="left">
<table border="0" cellpadding="5" cellspacing="0" style="font-size: 9pt; border-collapse:collapse" bgcolor="#C0C0C0" bordercolor="#111111">



<?
$sql = "SELECT * FROM taken ORDER BY number";

$result = mysql_query($sql);

mysql_close($connection);

//Loop through records and display users

while ($column = mysql_fetch_array($result))
{
?>
<th>
<b><th align="left"><font color="#000000"><?echo $column["number"];?></b></td>
</th>
<? }
?>
</table></center>
</div>
<br>


</body>





<html>


When looking at the application it should look like this:

Car/Truck Number: Please make sure it is available | Entry Box | 21, 48, 75, etc (car numbers already) listed in db

Colors are used to show different things only in this reply

Hope this helps.
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on April 26, 2008, 08:30:41 PM
here is an image of what I am trying to accomplish.  Maybe easier to explain to display it.

TO the left you will see numbers manually entered in that are taken, but I want the taken.php script to display them to the right of the entry box.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.cs-racin.com%2Fimages%2Fnumbers.jpg&hash=e51195aaef5e978b558c161cbbd8c91a01834a7f)
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 26, 2008, 10:17:32 PM
I think I can simplify things a bit. First, delete the taken.php file.

Change

echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Car/Truck Number: Please make sure it is available</TD>
<TD><INPUT id="number" name="number" type="text" value ="';
include '/numbers/taken.php';
if (isset($_POST['number'])) echo $_POST['number'];   
echo '" /></TD>


to


echo '" /></TD></TR>
        <TR class ="windowbg">
          <TD width = "200px">Car/Truck Number: Please make sure it is available</TD>
          <TD><INPUT id="number" name="number" type="text" value ="';
if (isset($_POST['number'])) echo $_POST['number']; 
echo '">';
$result = db_query("SELECT *
                    FROM taken
                    ORDER BY number", __FILE__, __LINE__);
while ($column = mysql_fetch_array($result))
  $taken[] = $column['number'];
$numbers = implode(", ",$taken);
echo $numbers;
echo '</TD>


I think your major problem was that you were having the "taken" numbers printed out within the input field. Also, you didn't need to create an entire page. But it's just as easy to put it into the article itself so that if you need to edit it, it's right there for you to work on, rather than having a separate file.

You can add whatvever formatting you want to the numbers. Just be sure that you put it in single quotes. Something like


echo '<font color="#000000">' . $numbers . '</font>';


Since at the time of printout, all of the numbers are in one variable, with commas and spaces between them, you can also add text to it, such as


echo '<font color="#000000">Numbers taken - ' . $numbers . '</font>';


Of course, I haven't tested this, but I'm pretty sure I've got all the semi-colons where they need to go. :)
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on June 01, 2008, 05:09:47 PM
Hi all,

Ok I am liking this script more and more and using it for various things.  I do have one question that I am trying to do.

I am trying to get in the forum topic that is started in the subject line from the form.  The information I am trying to get on the subject line is from some of the actual stuff in the form.  I have tried removing the ['user']['name'] and adding the field id names from the form and that doesn't work.

Report has been filed for "Series", "Date", Track" instead of the original [Pending] Application of [Membername]

I know the info being posted is from this section:
//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);


Any help on this would be greatly appreciated.

Thanks in advance.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on June 01, 2008, 05:19:52 PM
QuoteI have tried removing the ['user']['name'] and adding the field id names from the form and that doesn't work.

What exactly did you do? Give us the code you used and exactly what you want to accomplish. Details, details, details!!! :)
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on June 01, 2008, 05:43:45 PM
Quote from: JPDeni on June 01, 2008, 05:19:52 PM
QuoteI have tried removing the ['user']['name'] and adding the field id names from the form and that doesn't work.

What exactly did you do? Give us the code you used and exactly what you want to accomplish. Details, details, details!!! :)


Hi JPDeni,

Thanks for the reply

Here is the code I tried to use that will not work for some reason.
//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => 'Post Race Inspection Report for  ' . $context['series']['date']['track'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,


Under the $msgOptions = array(  is what I was trying to modify.  I don't need the username who filed the report listed in the subject line of the forum topic, just the info I listed in my original post above your reply.

Hope this helps
Title: Re: [Done!] Join Us! form
Post by: JPDeni on June 01, 2008, 08:57:15 PM
Where did you get the value for


$context['series']['date']['track'],


What does "doesn't work" mean? Do you get nothing? Do you get an error message? Is there an error in your error log? What happens?
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on June 01, 2008, 09:16:20 PM
The $context['series']['date']['track'] are fields that I am currently using in the form to have a person input value for.

As far as it not working, it only shows "'Post Race Inspection Report for  " which I am wanting it to show EXAMPLE - "'Post Race Inspection Report for Pro Series, Milwaukee, 05/15/08" in the subject line once form has been submitted.  All other information in the body of the topic and email sent shows up properly.

Here is my entire script that I am using.

if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for  Clan membership.';
} else  {


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='admin@cs-racin.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=33.0;

//the id of the this article
$this_article_id = '15';

//article to be redirected when form is submitted
$thank_you_article_id = '6';


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a series
if (empty($_POST['series']) ){
$enroll_errors[] = 'You forgot to enter a series.';
}
// Check for an date
if (empty($_POST['date']) ){
$enroll_errors[] = 'You forgot to enter your a Race Date.';
}   
// Check for an Track
if (empty($_POST['track']) ){
$enroll_errors[] = 'You forgot to enter a Track.';
}
// Check for an Length
if (empty($_POST['length']) ){
$enroll_errors[] = 'You forgot to enter Race Length.';
}

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email a Report

$subject = 'Post Race Inspection Report';
$body = 'Post Race Inspection Report has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Series:  ' . $_POST['series'] . '
Race Date:  ' . $_POST['date'] . '
Track:  ' . $_POST['track'] . '
Race Length: ' . $_POST['length'] . '
Drivers Checked:  ' . $_POST['checked'] . '
Drivers who Failed Inspection:  ' . $_POST['failed'] . '
Cheats Used:  ' . $_POST['cheat'] ;


$postbody = 'Post Race Inspection Report has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Series:[/td][td]  ' . $_POST['series'] . '[/td][/tr]
[tr][td]Race Date:[/td][td]  ' . $_POST['date'] . '[/td][/tr]
[tr][td]Track:[/td][td]  ' . $_POST['track'] . '[/td][/tr]
[tr][td]Race Length: [/td][td]' . $_POST['length'] . '[/td][/tr]
[tr][td]Drivers Checked:[/td][td]  ' . $_POST['checked'] . '[/td][/tr]
[tr][td]Drivers who failed Inspection:[/td][td]  ' . $_POST['failed'] . '[/td][/tr]
[tr][td]Cheats Used:[/td][td]  ' . $_POST['cheat'] . '[/td][/tr]
[/table]';


            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => 'Post Race Inspection Report for  ' . $context['series']['date']['track'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form
echo'
<p align="center"><b><font face="Comic Sans MS" size="5" color="#FF0000">Post
Race Inspection Report</font></b></p>
<p align="center"> </p>
<p align="center"><b><font face="Comic Sans MS" color="#FF0000">Please make sure
you fill this out with all required information.</font></b></p>
<p align="center"><b><font face="Comic Sans MS" color="#FF0000">All cheats that
are shown, please copy/paste the actual cheat information in the Cheats Used
block.  If multiple drivers are found to be cheating please break each
driver down and the cheat used in the given format in the Post Race Inspection
Forum Area.</font></b></p>
<p align="center"><font face="Comic Sans MS" color="#00FFFF">Thank you for your
assistance in making this league a Cheat Free League.<br>
</font>
</p>

';
echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">Series Checked:</TD>
<TD><INPUT id="series" name="series" type="text" value ="';
if (isset($_POST['series'])) echo $_POST['series'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Date of Race:</TD>
<TD><INPUT id="date" name="date" type="text" value ="';
if (isset($_POST['date'])) echo $_POST['date']; else echo $user_info['date']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Track:</TD>
<TD><INPUT id="track" name="track" type="text" value ="';
if (isset($_POST['track'])) echo $_POST['track'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Race Length:</TD>
<TD><INPUT id="length" name="length" type="text" value ="';
if (isset($_POST['length'])) echo $_POST['length'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Drivers Checked</TD>
<TD><INPUT id="checked" name="checked" type="text" value ="';
if (isset($_POST['checked'])) echo $_POST['checked'];
echo '" /></TD></TR>
<TR class ="windowbg2">
<TD width = "200px">List Drivers who Failed Post Race Inspection</TD>
<TD><TEXTAREA id="failed" name ="failed" rows="4" cols="40" value ="';
if (isset($_POST['failed'])) echo $_POST['failed'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">List and copy/paste Cheats used for each Driver</TD>
<TD><TEXTAREA id="cheat" name ="cheat" rows="4" cols="50" value ="';
if (isset($_POST['cheat'])) echo $_POST['cheat'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<p align="center"><font color="#FF0000"><b>By submitting this Post Race Inspection Report, you agree that all information provided is true to the best of your knowledge.</b></font></p>
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
}
Title: Re: [Done!] Join Us! form
Post by: JPDeni on June 01, 2008, 09:36:29 PM
I see. The $context array is defined elsewhere in SMF, and not in the form script. What you need to use is the $_POST array.

After


$postbody = 'Post Race Inspection Report has been made by ' . $context['user']['name'] .'
[table]
[tr][td]Series:[/td][td]  ' . $_POST['series'] . '[/td][/tr]
[tr][td]Race Date:[/td][td]  ' . $_POST['date'] . '[/td][/tr]
[tr][td]Track:[/td][td]  ' . $_POST['track'] . '[/td][/tr]
[tr][td]Race Length: [/td][td]' . $_POST['length'] . '[/td][/tr]
[tr][td]Drivers Checked:[/td][td]  ' . $_POST['checked'] . '[/td][/tr]
[tr][td]Drivers who failed Inspection:[/td][td]  ' . $_POST['failed'] . '[/td][/tr]
[tr][td]Cheats Used:[/td][td]  ' . $_POST['cheat'] . '[/td][/tr]
[/table]';


add


$subject = "Post Race Inspection Report for ' . $_POST['series'] . ' ' . $_POST['track'] . ' ' . $_POST['date'];


Change

'subject' => 'Post Race Inspection Report for  ' . $context['series']['date']['track'],


to


'subject' => $subject,
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on June 01, 2008, 10:12:23 PM
Ok got the following error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mysite/public_html/Sources/Load.php(1789) : eval()'d code(246) : eval()'d code on line 91

Line 91 is
$subject = "Post Race Inspection Report for ' . $_POST['series'] . ' ' . $_POST['track'] . ' ' . $_POST['date'];
Title: Re: [Done!] Join Us! form
Post by: JPDeni on June 02, 2008, 01:10:33 AM
Sorry. Got my quotation marks mixed up.


$subject = 'Post Race Inspection Report for ' . $_POST['series'] . ' ' . $_POST['track'] . ' ' . $_POST['date'];
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on June 02, 2008, 02:08:04 AM
AWESOME as always you come through.  THANK YOU very much for your help it is Greatly Appreciated. :up:   ;)

Title: Re: [Done!] Join Us! form
Post by: CliMa on June 07, 2008, 02:45:51 AM
hey, i'm new to the forum and found this form to my site, and i tried to edit the fields but got an error.

If anyone can help me change the forms so it has:

Real Name
Email address
Current PSN Name
Age
Gender
Location
Previous league(s)
Would like to help pay for a site?
Why do you want to join our league?
Gaming habbits
Other information


So any help would be very much appreciated

Thanks

CliMa
Title: Re: [Done!] Join Us! form
Post by: Chevy21 on June 07, 2008, 02:56:00 AM
Welcome!

What errors are you getting?
Title: Re: [Done!] Join Us! form
Post by: CliMa on June 07, 2008, 01:27:44 PM
my fault that will teach me for working on new stuff at 3am lol i must of delted a rong bit because its working fine now. but when i submit a test form it takes me to an arcade game and doesn't send me an email or anything

Also how would i put in a bit for date of birth ?
Title: Re: [Done!] Join Us! form
Post by: JPDeni on June 07, 2008, 01:50:18 PM
There seems to be a conflict between the arcade mod and forms on TinyPortal. I don't know how to get around it.
Title: Re: [Done!] Join Us! form
Post by: Talliostro on June 09, 2008, 09:43:31 AM
Hi everybody,

I've got a question here. I like the code alot, but is there a way to display everything in a kind of a rooster page?
I'm currently at work and can't read the whole thread...

I'm admin of a big tabletop community site here in germany and want to collect infos about the gaming clubs and gaming meetings around germany/austria/switzerland.
It's okay, that it displays a new forum-thread, but I would like to have a page where every application is displayed for direct linking in the page menu.
Is this possible?
I'm not a php crack, I can change provided code as necessary, but I can't (not yet) write some by myself...
Thnaks for possible answers.
Title: Re: [Done!] Join Us! form
Post by: trench on July 04, 2008, 01:03:54 PM
Which code here actually works! So many pages I cant find the latest working one.
Title: Re: [Done!] Join Us! form
Post by: DOOM666 on August 08, 2008, 01:25:05 AM
i keep getting this error when a guest applys when i try ready it.

QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3
File: /home/wudojo/public_html/forums/Sources/Display.php
Line: 721
Title: Re: [Done!] Join Us! form
Post by: Deadfire on August 25, 2008, 05:18:31 PM
Is there a way to make this form also register the user to the forum as well?
Title: Re: [Done!] Join Us! form
Post by: Kronos on September 05, 2008, 05:36:48 PM
I've tried customizing this for my own guild website but I broke it and had to start all over using the original code provided in this topic several times now because I'm really not that good at PHP.

Could anyone be arsed customizing it for me? Would really appreciate it allot.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on September 05, 2008, 06:24:52 PM
Deadfire, you'd be better off using the SMF registration functions, plus the Custom Fields mod.

Kronos, I don't want to go through the whole topic myself to find it, so if you'd post the code you were wanting to customize and exactly what you want changed, I'll give it a try.
Title: Re: [Done!] Join Us! form
Post by: Kronos on September 05, 2008, 07:03:21 PM
Thanks if you're willing to give it a go, it's quite some changes though.
Where I'd like a small text area for just a word or 3 I'll say TEXT, for a bigger textfield i'll say TEXTFIELD and for a drop down menu I'll say just that with the options I'd like.

QuoteName: TEXT
Age: TEXT
Any activities that will effect your availability (work/school/social): TEXTFIELD
A little about yourself: TEXTFIELD
Computer Specs (does your computer lag? do you have connection trouble?): TEXTFIELD

Information about your character
Class: DROPDOWN - Druid - Hunter - Mage - Paladin - Priest - Rogue - Shaman -Warlock - Warrior - Death Knight
Race: DROPDOWN - Orc - Undead - Troll - Tauren - Blood Elf
Alts (name/level/class/race/server): TEXTFIELD
Experience (Include which character this is on)
Pre-TBC: TEXTFIELD
TBC: TEXTFIELD
WotLK: TEXTFIELD
Spec: TEXTFIELD

Do you enjoy your main spec (you will be raiding in this spec): DROPDOWN - Yes - No

Willing to respec if the guild ask you to: DROPDOWN - Yes - No
Link to your armoury: TEXT
Do you have any resistance gear: TEXTFIELD
/Played: TEXT
Profession, and any rare recipes: TEXTFIELD
How much gold do you have: TEXT

Are you available to raid from 19.00 - 23.00 hours on the following days?
Monday: DROPDOWN - Yes - No
Tuesday: DROPDOWN - Yes - No
Wednesday: DROPDOWN - Yes - No
Thursday: DROPDOWN - Yes - No
Friday: DROPDOWN - Yes - No
Saturday: DROPDOWN - Yes - No

Do you have anything planned that will effect your availability (holidays/exams etc): TEXTFIELD
Heroic keys: TEXTFIELD
What can you offer Eternal Pain: TEXTFIELD
What are you looking for from Eternal Pain: TEXTFIELD
Do you know anyone in the guild who can vouch for you: TEXT
Have you applied anywhere else: TEXTFIELD
(or if possible, a dropdown with yes or no, if yes is selected a textfield, if no no textfield)

Previous guilds / reasons for leaving: TEXTFIELD
Can you confirm you have read, understand and agree to the guildrules? DROPDOWN - Yes - No
Further Comments: TEXTFIELD

As I've mentioned, its quite allot that needs to be added/changed so if you really cba I'll have to look somewhere else.

Oh and currently, I've set the guest permissions so that they cannot post. Though if you use this form whilst not logged in it does post as a guest, is there any way this can be fixed by for example showing "Please register" instead of the submit and reset buttons when you're not logged in or redirect?


Code:
global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of reqruitment staf member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=1;

//the id of the this article
$this_article_id = '6';

//article to be redirected when form is submitted
$thank_you_article_id = '5';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current AA In-Game Nick:</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Current Honor:</TD>
<TD><INPUT id="honor" name="honor" type="text" value ="';
if (isset($_POST['honor'])) echo $_POST['honor'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Previous clan(s) and reason of leaving:</TD>
<TD><TEXTAREA id="prev_clans" name="prev_clans" rows="4" cols="40" value ="';
if (isset($_POST['prev_clans'])) echo $_POST['prev_clans'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Have you ever been permanently banned from any sever (if yes, give details):</TD>
<TD><TEXTAREA id ="banned" name ="banned" rows="4" cols="40"  value ="';
if (isset($_POST['banned'])) echo $_POST['banned'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registered with AAOTracker?</TD>
<TD><SELECT id="aaotracker" name="aaotracker" style="WIDTH: 160px" value ="';
if (isset($_POST['aaotraker'])) echo $_POST['aaotraker'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">AAOTracker name:</TD>
<TD><INPUT id="aaotracker_name" name="aaotracker_name" type="text" value ="';
if (isset($_POST['aaotraker_name'])) echo $_POST['aaotraker_name']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Registred with X-fire?</TD>
<TD><SELECT id="xfire" name="xfire" style="WIDTH: 160px" value ="';
if (isset($_POST['xfire'])) echo $_POST['xfire'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">X-Fire Account:</TD>
<TD><INPUT id="xfire_name" name="xfire_name" type="text" value ="';
if (isset($_POST['xfire_name'])) echo $_POST['xfire_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you have TeamSpeak installed?:</TD>
<TD><SELECT id="ts" name="ts" style="WIDTH: 160px" value ="';
if (isset($_POST['ts'])) echo $_POST['ts'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have microphone/headset:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for a server?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join -WoW-?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Tell us about your gaming habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: JPDeni on September 05, 2008, 07:16:09 PM
I didn't realize you wanted their whole life story. :)

I'll see if I can get to it Monday. If someone else wants to tackle it before then, that's fine.
Title: Re: [Done!] Join Us! form
Post by: Kronos on September 05, 2008, 07:17:56 PM
Nah we just think many textfields are a good way to scare the noobs off :p

Really appreciate it, thanks in advance.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on September 11, 2008, 03:43:38 PM
Sorry it took so long. I forgot about it. (Getting old is no fun.  :) )

I altered the code so that it's easier to edit. I combined it with another thing I wrote a while back so you can define your fields at the beginning and the code takes care of the rest.

I've tested this out and it works, both with posting to the forum and sending email:



global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

$intro_form = "This is where you give any instructions for filling out the form.";   // Can include html

$thanks_text = "Thanks ever so much for applying. We'll review your application and get back to you."; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      "Name",
      'name' =>         "name",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      "Age",
      'name' =>         "age",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Any activities that will effect your availability (work/school/social)",
      'name' =>         "activities",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "A little about yourself",
      'name' =>         "bio",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Computer Specs (does your computer lag? do you have connection trouble?)",
      'name' =>         "computer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Information about your character",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Class",
      'name' =>         "class",
      'type' =>         "select",
      'options' =>      "Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior,Death Knight",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Race",
      'name' =>         "race",
      'type' =>         "select",
      'options' =>      "Orc,Undead,Troll,Tauren,Blood Elf",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Alts (name/level/class/race/server)",
      'name' =>         "alts",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Experience (Include which character this is on)",
      'name' =>         "heading2",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Pre-TBC",
      'name' =>         "pretbc",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
    array(
      'caption' =>      "TBC",
      'name' =>         "tbc",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
    array(
      'caption' =>      "WotLK",
      'name' =>         "WotLK",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
    array(
      'caption' =>      "Spec",
      'name' =>         "Spec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
     array(
      'caption' =>      "Do you enjoy your main spec (you will be raiding in this spec)",
      'name' =>         "enjoy",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
     array(
      'caption' =>      "Willing to respec if the guild ask you to",
      'name' =>         "respec",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      "Link to your armoury",
      'name' =>         "armoury",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
    array(
      'caption' =>      "Do you have any resistance gear",
      'name' =>         "resistance",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "/Played",
      'name' =>         "played",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
    array(
      'caption' =>      "Profession, and any rare recipes",
      'name' =>         "profession",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "How much gold do you have",
      'name' =>         "gold",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
    array(
      'caption' =>      "Are you available to raid from 19.00 - 23.00 hours on the following days?",
      'name' =>         "heading2",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
     array(
      'caption' =>      "Monday",
      'name' =>         "monday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
     array(
      'caption' =>      "Tuesday",
      'name' =>         "tuesday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
     array(
      'caption' =>      "Wednesday",
      'name' =>         "wednesday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
     array(
      'caption' =>      "Thursday",
      'name' =>         "thursday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
     array(
      'caption' =>      "Friday",
      'name' =>         "friday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
     array(
      'caption' =>      "Saturday",
      'name' =>         "saturday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      "Do you have anything planned that will effect your availability (holidays/exams etc)",
      'name' =>         "plans",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Heroic keys",
      'name' =>         "keys",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "What can you offer Eternal Pain",
      'name' =>         "offer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "What are you looking for from Eternal Pain",
      'name' =>         "looking",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
     array(
      'caption' =>      "Do you know anyone in the guild who can vouch for you",
      'name' =>         "vouch",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0   
    ),
    array(
      'caption' =>      "Have you applied anywhere else",
      'name' =>         "applied",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Previous guilds / reasons for leaving",
      'name' =>         "previous",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
     array(
      'caption' =>      "Can you confirm you have read, understand and agree to the guildrules?",
      'name' =>         "rules",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      "Further Comments",
      'name' =>         "comment",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);


//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=1;


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment Application';
  $body = 'Enrollment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
                   <table>';
      foreach ($fielddef as $field) {
        $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
      }
      $postbody .= '</table>';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="100%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
    elseif ($field['type'] == 'heading') {
      echo '<TR class ="' . $bg . '">
            <TD colspan="2">' .
            $field['caption'] .
            '</TD></TR>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }
  echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}



I did some guessing on which fields you would like to have required. You can easily change them.

I also eliminated the need for a separate "Thank you" page. You can put whatever you want to display on the page after the form is submitted in the $thanks_text variable, which is defined right near the top.

I also added a "field type" called header, which just sets off different sections. You can put any html in there that you want, to make the text centered or bigger or bolder or whatever. Just be sure you don't set the header to being required.  :)
Title: Re: [Done!] Join Us! form
Post by: Kronos on September 11, 2008, 07:18:24 PM
Thank you so much, really nice.
Title: Re: [Done!] Join Us! form
Post by: CliMa on September 14, 2008, 01:25:25 AM
Hi guys i created a form and got it all sorted with sending the email but when i click submit and wait to go onto the thank you page it gives me an error saying cannot find page. for the thank you page its number 71, Heres the coding i am using, any help would be great.

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='----@hotmail.co.uk';

//post the application on forum?
$enable_post=False;

//board id to which the application should be posted
$board_id=16;

//the id of the this article
$this_article_id = '72';

//article to be redirected when form is submitted
$thank_you_article_id = '71';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an PSN name
if (empty($_POST['psn_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';

// Check for Available Times
if (empty($_POST['available']) ){
$enroll_errors[] = 'You forgot to enter your available times.';

// Check for Preferred Position
if (empty($_POST['position']) ){
$enroll_errors[] = 'You forgot to enter your preferred position.';



if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Application Form';
$body = 'Application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['psn_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Available Times:  ' . $_POST['available'] . '
Preferred Position:  ' . $_POST['position'] . '
Would like to help pay for the site?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'];

$postbody = 'Application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['psn_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Available Times:  <td></td><td> ' . $_POST['available'] . '</td></tr>
<tr><td>Preferred Position: <td></td><td> ' . $_POST['position'] . '</td></tr>
<tr><td>Would like to help pay for the site?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'smf/index.php?page=71' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Current PSN Nick:</TD>
<TD><INPUT id="psn_name" name="psn_name" type="text" value ="';
if (isset($_POST['psn_name'])) echo $_POST['psn_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Available Times(for play/practice):</TD>
<TD><TEXTAREA id="available" name="available" rows="4" cols="40" value ="';
if (isset($_POST['available'])) echo $_POST['available'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Preferred Position:</TD>
<TD><TEXTAREA id ="position" name ="position" rows="4" cols="40"  value ="';
if (isset($_POST['position'])) echo $_POST['position'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Would you help pay for the site?:</TD>
<TD><SELECT id="pay" name="pay" style="WIDTH: 160px" value ="';
if (isset($_POST['pay'])) echo $_POST['pay'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Monthly">Yes, monthly</OPTION>
<OPTION value="Occasionally">Yes, occasionally</OPTION>
<OPTION value="Not">No, not now</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Why do you want to join World Elite League?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
Title: Re: [Done!] Join Us! form
Post by: JPDeni on September 14, 2008, 02:18:02 AM
It looks like you changed the code. The original line is


header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);


You have


header('Location: http://' . $_SERVER['HTTP_HOST'] .'smf/index.php?page=71' . $thank_you_article_id);


IOW, it's looking for page=7171.

Change it back to the original and you should be fine.
Title: Re: [Done!] Join Us! form
Post by: CliMa on September 14, 2008, 11:09:32 AM
Thanks for your quick reply.

I changed that but still getting "HTTP 404 Not Found" when i hit submit.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on September 14, 2008, 01:09:18 PM
Are you sure there is a page 71?

If so, try something else...

In the first line of the code, add $scripturl to the list of variables. It should look like


global $sourcedir, $user_info, $context, $scripturl ;


Then change


header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);


to


header('Location: ' . $scripturl . '?page=' . $thank_you_article_id);
Title: Re: [Done!] Join Us! form
Post by: CliMa on September 14, 2008, 09:20:07 PM
Thanks mate worked a treat, also is there a way i can move the form so its in the center,

any ideas ?
Title: Re: [Done!] Join Us! form
Post by: JPDeni on September 14, 2008, 11:06:16 PM
Change


echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">


to


echo '
<center><form action="index.php?page='  . $this_article_id  . '" method="post">


and change


</form>


to


</form></center>


If you have any other questions, could you put them all in one post, please?
Title: Re: [Done!] Join Us! form
Post by: CliMa on September 14, 2008, 11:11:28 PM
Thank you mate all working perfectly !
Title: Re: [Done!] Join Us! form
Post by: DOOM666 on December 14, 2008, 05:22:42 AM
ok i have three of made up 2 out of the 3 are working and im bafold on why this one wont work. it started when i installed the E-Arcade mod.

ok when i hit submint it will go to the arcade section. here is the code i have.

{
  echo '
<center><h1>Associate Application </h1></center>
<b><p>This must be read, and These steps should be followed by anyone trying out, or going to start the process of becoming part of Empir3 . All this must be done before acceptance, and before a final decision is made. So to better your chances, complete the list below.<br /><br />


1. Read, agree, sign and abide by all posted rules. And those told to you by a High Rank <a   href="http://www.empir3.us/index.php?topic=2.0">Link to Rules/Skript </a>Please Sign<br /><br />

2. Fill out the Empir3 Associate Application completely<br /><br />

3. During your Associate Trial Empir3 Boss & High Ranks will discuss and go over you app & where you were reffered from. <br /><br />

4. Send invites to current members, mainly High Ranks, and Boss<br><br >
6. The trial period will basically depend on you, it will last anywhere from 7 to 30 days. Those that play more often with us, more active on the forums etc. will of course have a quicker trial. So during your Associate Trial, be active as much as possible to better your chances.
<br><br>
Best of luck to you. Hope to see you in game.</p>';
}

if ($context['user']['is_guest'])

{
   echo '
   <h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for Clan membership.';
} else  {

global $sourcedir, $user_info, $context;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of reqruitment staf member
$email_address='sjreilley@verizon.net';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=7;

//the id of the this article
$this_article_id = '3';

//article to be redirected when form is submitted
$thank_you_article_id = '4';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['psn_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for an Socom  ca name
if (empty($_POST['socom_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Nickname.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) {

                //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Associate Application';
$body = 'Associate application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '

PSN Name:  ' . $_POST['psn_name'] . '
Email address:  ' . $_POST['email'] . '
Socom CA Name:  ' . $_POST['socom_name'] . '
Socom CON Name: ' . $_POST['con_name'] . '
Age: ' . $_POST['age'] . '
Do you play Con., CA or both: ' . $_POST['both'] . '
Do you have access to log on CA for clan meetings: ' . $_POST['access'] . '
Myspace URL or other profile information: ' . $_POST['myspace'] . '
Any other names on any Socom:  ' . $_POST['other_name'] . '
Name of Room/Server you were recruited in:  ' . $_POST['server'] . '
Recruited by: ' . $_POST['by'] . '
Website referral by:  ' . $_POST['referral'] . '
Currently a member of another clan: ' . $_POST['member'] . '
Trying out for another clan:' . $_POST['trying'] . '</font>
Belong to another clan on any other games: ' . $_POST['mic'] . '
If yes, what clans and on which games:   ' . $_POST['clans'] . '
Past Clans (for all games): ' . $_POST['past'] . '
How often do you play: ' . $_POST['often'] . '
What games do you play online:   ' . $_POST['play'] . '
What can you bring to building Empir3: ' . $_POST['why'] . '
Any web graphic sills, scripting, etc.:  ' . $_POST['graphic'] . '
What do you expect from joining Empir3:   ' . $_POST['expect'] . '
Additional Info (may add anything you like):  ' . $_POST['other'];

$postbody = 'Associate application has been made by [color=blue]' . $context['user']['name'] .'[/color]
<table>
PSN Name: [color=red] ' . $_POST['psn_name'] . '[/color]
Email address:[color=red] ' . $_POST['email'] . '[/color]
Socom CA Name:[color=red]' . $_POST['socom_name'] . '[/color]
Socom CON Name:[color=red]' . $_POST['con_name'] . '[/color]
Age:[color=red]  ' . $_POST['age'] . '[/color]
Do you play Con., CA or both:[color=red]  ' . $_POST['both'] . '[/color]
Do you have access to log on CA for clan meetings:[color=red] ' . $_POST['access'] . '[/color]
Myspace URL or other profile information: [color=red]' . $_POST['myspace'] . '[/color]
Any other names on any Socom: [color=red] ' . $_POST['other_name'] . '[/color]
Name of Room/Server you were recruited in:[color=red]  ' . $_POST['server'] . '[/color]
Recruited by:[color=red] ' . $_POST['by'] . '[/color]
Website referral by: [color=red]  ' . $_POST['referral'] . '[/color]
Currently a member of another clan:[color=red] ' . $_POST['member'] . '[/color]
Trying out for another clan:[color=red] ' . $_POST['trying'] . '[/color]
Belong to another clan on any other games: [color=red] ' . $_POST['mic'] . '[/color]
If yes, what clans and on which games:  [color=red] ' . $_POST['clans'] . '[/color]
Past Clans (for all games): [color=red] ' . $_POST['past'] . '[/color]
How often do you play:[color=red]   ' . $_POST['often'] . '[/color]
What games do you play online: [color=red]  ' . $_POST['play'] . '[/color]
What can you bring to building Empir3: [color=red] ' . $_POST['why'] . '[/color]
Any web graphic sills, scripting, etc.:[color=red]  ' . $_POST['graphic'] . '[/color]
What do you expect from joining Empir3:[color=red]  ' . $_POST['expect'] . '[/color]
Additional Info (may add anything you like):[color=red]  ' . $_POST['other']. '[/color]
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id);
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
} //else {

// Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* PSN Name:</TD>
<TD><INPUT id="psn_name" name="psn_name" type="text" value ="';
if (isset($_POST['psn_name'])) echo $_POST['psn_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Socom Ca Name:</TD>
<TD><INPUT id="socom_name" name="socom_name" type="text" value ="';
if (isset($_POST['socom_name'])) echo $_POST['socom_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Socom CON Name:</TD>
<TD><INPUT id="con_name" name="con_name" type="text" value ="';
if (isset($_POST['con_name'])) echo $_POST['con_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you play Con., CA or both:</TD>
<TD><SELECT id = "both" name = "both" style="WIDTH: 152px" value ="';
if (isset($_POST['both'])) echo $_POST['both'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Confrontation">Confrontation</OPTION>
<OPTION value="Combined Assault">Combined Assault</OPTION>
<OPTION value="Both">Both</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have access to log on CA for clan meetings:</TD>
<TD><SELECT id = "access" name = "access" style="WIDTH: 152px" value ="';
if (isset($_POST['access'])) echo $_POST['access'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Myspace URL or other profile information: </TD>
<TD><INPUT id="myspace" name="myspace" type="text" value ="';
if (isset($_POST['myspace'])) echo $_POST['myspace'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any other names on any Socom: </TD>
<TD><INPUT id="other_name" name="other_name" type="text" value ="';
if (isset($_POST['other_name'])) echo $_POST['other_name'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Name of Room/Server you were recruited in: </TD>
<TD><INPUT id="server" name="server" type="text" value ="';
if (isset($_POST['server'])) echo $_POST['server'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Recruited by: </TD>
<TD><INPUT id="by" name="by" type="text" value ="';
if (isset($_POST['by'])) echo $_POST['by'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Website referral by: </TD>
<TD><INPUT id="referral" name="referral" type="text" value ="';
if (isset($_POST['referral'])) echo $_POST['referral'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Currently a member of another clan:</TD>
<TD><SELECT id="member" name="member" style="WIDTH: 160px" value ="';
if (isset($_POST['member'])) echo $_POST['member'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Trying out for another clan: </TD>
<TD><SELECT id="trying" name="trying" style="WIDTH: 160px" value ="';
if (isset($_POST['trying'])) echo $_POST['trying'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Belong to another clan on any other games:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">If yes, what clans and on which games:</TD>
<TD><INPUT id="clans" name="clans" type="text" value ="';
if (isset($_POST['clans'])) echo $_POST['clans'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Past Clans (for all games):</TD>
<TD><INPUT id="past" name="past" type="text" value ="';
if (isset($_POST['past'])) echo $_POST['past'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">How often do you play: </TD>
<TD><INPUT id="often" name="often" type="text" value ="';
if (isset($_POST['often'])) echo $_POST['often'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What games do you play online:</TD>
<TD><INPUT id="paly" name="play" type="text" value ="';
if (isset($_POST['play'])) echo $_POST['play'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What can you bring to building Empir3:</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Any web graphic skills, scripting, etc.:</TD>
<TD><INPUT id="graphic" name="graphic" type="text" value ="';
if (isset($_POST['graphic'])) echo $_POST['graphic'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What do you expect from joining Empir3:</TD>
<TD><TEXTAREA id="expect" name="expect" rows="4" cols="40" value ="';
if (isset($_POST['expect'])) echo $_POST['expect'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Additional Info (may add anything you like):</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
}
Title: Re: [Done!] Join Us! form
Post by: JPDeni on December 14, 2008, 05:30:25 AM
The problem with the arcade was to be a problem that a lot of people had. I was never able to figure out why.
Title: Re: [Done!] Join Us! form
Post by: DOOM666 on December 14, 2008, 05:41:53 AM
i dont get i have two more that do work one for my graphix team and one more for a challenge us page and they still work.

here is the code that works for my challenge us page,


{
  echo '
<center><h1>Challenge Empir3</h1></center>';
}

if ($context['user']['is_guest'])

{
   echo  '
   <h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order challenge Empir3.';
} else  {

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');

// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of leader
$email_address='killacal77@yahoo.com ';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=19;

//the id of the this article
$this_article_id = '6';

//article to be redirected when form is submitted
$thank_you_article_id = '7';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['clan_name']) ){
$enroll_errors[] = 'You forgot to enter your clan name.';
}
// Check for a clan tag
if (empty($_POST['clan_tag']) ){
$enroll_errors[] = 'You forgot to enter your clan tag.';
}
// Check for the type of challenge
if (empty($_POST['challenge']) ){
$enroll_errors[] = 'You forgot to enter the type of challenge.';
}       
// Check for a date
if (empty($_POST['date']) ){
$enroll_errors[] = 'You forgot the date.';

// Check for a requested time
if (empty($_POST['time']) ){
$enroll_errors[] = 'You forgot to request a time.';
        }
// Check for a map
if (empty($_POST['map']) ){
$enroll_errors[] = 'You forgot the map.';
        }
// Check for weapon stipulations
if (empty($_POST['weapon']) ){
$enroll_errors[] = 'You forgot the weapon stipulations.';
        }

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Clan Challenge';
$body = 'A challenge has been made by ' . $_POST['clan_name'] .
' from IP Address ' . $user_info['ip'] . '

Email address:  ' . $_POST['email'] . '
Clan Name:  ' . $_POST['clan_name'] . '
Clan Tag:  ' . $_POST['clan_tag'] . '
Type of Challenge:  ' . $_POST['challenge'] . '
Date: ' . $_POST['date'] . '
Requested Time: ' . $_POST['time'] . '
Socom CA or CON: ' . $_POST['ca_con'] . '
Your Map: ' . $_POST['map'] . '
Weapon stipulations: ' . $_POST['weapon'] . '
Additional Comments: ' . $_POST['comments'];


$postbody = 'A challenge has been made by[color=blue] ' . $_POST['clan_name'] . '[/color]
<table>
Clan Name: [color=red] ' . $_POST['clan_name'] . '[/color]
Clan Tag:[color=red]  ' . $_POST['clan_tag'] . '[/color]
Type of Challenge:[color=red]  ' . $_POST['challenge'] . '[/color]
Date:[color=red]  ' . $_POST['date'] . '[/color]
Requested Time:[color=red]  ' . $_POST['time'] . '[/color]
Socom CA or CON:[color=red] ' . $_POST['ca_con'] . '[/color]
Your Map:[color=red]' . $_POST['map'] . '[/color]
Weapon stipulations:[color=red] ' . $_POST['weapon'] . '[/color]
Additional Comments:  [color=red]' . $_POST['comments'] . '[/color]
</table>';


            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] challenge from ' . $_POST['clan_name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' .

$thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1"

width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">* Clan Name</TD>
<TD><INPUT id="clan_name" name="clan_name"

type="text" value ="';
if (isset($_POST['clan_name'])) echo $_POST['clan_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Clan Tag:</TD>
<TD><INPUT id="clan_tag" name="clan_tag" type="text"

value ="';
if (isset($_POST['clan_tag'])) echo $_POST['clan_tag'];
echo '" /></TD>
                                                </TR>
                                                 <TR class ="windowbg">
<TD width = "200px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
                                               </TR>
<TR class ="windowbg2">
<TD width = "200px">* Type of Challenge:</TD>
<TD><INPUT id="challenge" name="challenge"

type="text" value ="';
if (isset($_POST['challenge'])) echo $_POST['challenge'];
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Date:</TD>
<TD><INPUT id="date" name="date" type="text" value

="';
if (isset($_POST['date'])) echo $_POST['date'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">* Requested Time:</TD>
<TD><INPUT id="time" name="time" type="text" value

="';
if (isset($_POST['time'])) echo $_POST['time'];   
echo '" /></TD>

</TR>
<TR class ="windowbg">
<TD width = "200px">Socom CA or CON:
</TD>
<TD><SELECT id = "ca_con" name = "ca_con" style="WIDTH: 152px" value ="';
if (isset($_POST['ca_con'])) echo $_POST['ca_con'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Confrontation">Confrontation</OPTION>
<OPTION value="Combined Assault">Combined Assault</OPTION>

</SELECT></TD>


</TR>
<TR class ="windowbg2">
<TD width = "200px">* Your Map:</TD>
<TD><INPUT id="map" name="map" type="text" value

="';
if (isset($_POST['map'])) echo $_POST['map'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">* Weapon stipulations:</TD>
<TD><INPUT id="weapon" name="weapon" type="text"

value ="';
if (isset($_POST['weapon'])) echo $_POST['weapon'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Additional Comments:</TD>
<TD><TEXTAREA id="comments" name = "comments"

rows="4" cols="40" value ="';
if (isset($_POST['comments'])) echo $_POST['comments'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
}
Title: Re: [Done!] Join Us! form
Post by: DOOM666 on December 15, 2008, 09:43:37 PM
ok just to let you know that i got it to work the promble was the key words i used.

i had this

<TR class ="windowbg">
<TD width = "200px">What games do you play online:</TD>
<TD><INPUT id="paly" name="play" type="text" value ="';
if (isset($_POST['play'])) echo $_POST['play'];   
echo '" /></TD>


when i changed it to this it word

<TR class ="windowbg">
<TD width = "200px">What games do you play online:</TD>
<TD><INPUT id="games" name="games" type="text" value ="';
if (isset($_POST['games'])) echo $_POST['games'];   
echo '" /></TD>


it was just the words i was use i was using play changed it to games it work.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on December 15, 2008, 10:22:02 PM
Ah. I see. Excellent. Thanks for posting your solution. There must be something in the arcade thing that uses the "play" variable.

That's a mystery solved!  :up:
Title: Re: [Done!] Join Us! form
Post by: Vapor on December 28, 2008, 05:14:55 PM
Tons of typos in your form, but sweet work anyways  :laugh:
Title: Re: [Done!] Join Us! form
Post by: umiya on December 29, 2008, 04:14:07 AM
Lets say one wanted to change the posted text to another color.  I.E. after the form is filled out the areas they filled in would be red and the questions would be in white.
Title: Re: [Done!] Join Us! form
Post by: Vapor on December 29, 2008, 08:58:37 AM
Just add this around the text :


<font color="#FF0000">put your text here</font>


Just change the hex color code to suit your needs...the text color above is RED, and for white change it to "000000" .

Hope that helps
Title: Re: [Done!] Join Us! form
Post by: Vapor on December 29, 2008, 09:00:54 AM
d'oh...i just re read your post, you want "posted" text to be colored huh? Im not sure where you would put the code i put in, but that is what you would need to plug in. I just dont know where.  :'(
Title: Re: [Done!] Join Us! form
Post by: Vapor on December 31, 2008, 06:24:56 AM
ok...posts say "pending"....how do i "approve" posts?


[SOLVED]
Title: Re: [Done!] Join Us! form
Post by: Inny on February 04, 2009, 12:00:31 PM
[code]

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

$intro_form = "This is where you give any instructions for filling out the form.";   // Can include html

$thanks_text = "Thanks ever so much for applying. We'll review your application and get back to you."; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      "Name",
      'name' =>         "name",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1  
    ),
    array(
      'caption' =>      "Age",
      'name' =>         "age",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Any activities that will effect your availability (work/school/social)",
      'name' =>         "activities",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "A little about yourself",
      'name' =>         "bio",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Computer Specs (does your computer lag? do you have connection trouble?)",
      'name' =>         "computer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Information about your character",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Class",
      'name' =>         "class",
      'type' =>         "select",
      'options' =>      "Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior,Death Knight",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Race",
      'name' =>         "race",
      'type' =>         "select",
      'options' =>      "Orc,Undead,Troll,Tauren,Blood Elf",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Alts (name/level/class/race/server)",
      'name' =>         "alts",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Experience (Include which character this is on)",
      'name' =>         "heading2",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Pre-TBC",
      'name' =>         "pretbc",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
    array(
      'caption' =>      "TBC",
      'name' =>         "tbc",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
    array(
      'caption' =>      "WotLK",
      'name' =>         "WotLK",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
    array(
      'caption' =>      "Spec",
      'name' =>         "Spec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
     array(
      'caption' =>      "Do you enjoy your main spec (you will be raiding in this spec)",
      'name' =>         "enjoy",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
     array(
      'caption' =>      "Willing to respec if the guild ask you to",
      'name' =>         "respec",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
    array(
      'caption' =>      "Link to your armoury",
      'name' =>         "armoury",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
    array(
      'caption' =>      "Do you have any resistance gear",
      'name' =>         "resistance",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "/Played",
      'name' =>         "played",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
    array(
      'caption' =>      "Profession, and any rare recipes",
      'name' =>         "profession",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "How much gold do you have",
      'name' =>         "gold",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
    array(
      'caption' =>      "Are you available to raid from 19.00 - 23.00 hours on the following days?",
      'name' =>         "heading2",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
     array(
      'caption' =>      "Monday",
      'name' =>         "monday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
     array(
      'caption' =>      "Tuesday",
      'name' =>         "tuesday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
     array(
      'caption' =>      "Wednesday",
      'name' =>         "wednesday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
     array(
      'caption' =>      "Thursday",
      'name' =>         "thursday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
     array(
      'caption' =>      "Friday",
      'name' =>         "friday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
     array(
      'caption' =>      "Saturday",
      'name' =>         "saturday",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
    array(
      'caption' =>      "Do you have anything planned that will effect your availability (holidays/exams etc)",
      'name' =>         "plans",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Heroic keys",
      'name' =>         "keys",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "What can you offer Eternal Pain",
      'name' =>         "offer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "What are you looking for from Eternal Pain",
      'name' =>         "looking",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
     array(
      'caption' =>      "Do you know anyone in the guild who can vouch for you",
      'name' =>         "vouch",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0  
    ),
    array(
      'caption' =>      "Have you applied anywhere else",
      'name' =>         "applied",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Previous guilds / reasons for leaving",
      'name' =>         "previous",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
     array(
      'caption' =>      "Can you confirm you have read, understand and agree to the guildrules?",
      'name' =>         "rules",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "",
      'required' =>     1  
    ),
    array(
      'caption' =>      "Further Comments",
      'name' =>         "comment",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);


//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=1;


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment Application';
  $body = 'Enrollment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
                   <table>';
      foreach ($fielddef as $field) {
        $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
      }
      $postbody .= '</table>';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="100%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';  
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';  
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
    elseif ($field['type'] == 'heading') {
      echo '<TR class ="' . $bg . '">
            <TD colspan="2">' .
            $field['caption'] .
            '</TD></TR>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }
  echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}





I like using your code JPDeni instead of the OP one because its easier for editing but also because i can fit it better with the guests application forms.

Only issue i have with is that i altered the heading code a bit to make it seem like a title of which type of questions following below it. Problem is that when its posted into forums the Heading its gets the coloring and the posting body of the all the other fields. What i say is if its possible to make the heading field post differently in forums.

Right now im using: foreach ($fielddef as $field) {
        $postbody .= '[color=green][b]' . $field['caption'] . '[/b][/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }


What i want to do is something like: foreach ($fielddef as $field) {
        $postbody .= '[color=red][b]' . $field['caption'] . '[/b][/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
[/code] for just the Heading array.

I tried changing the code to:

  elseif ($field['type'] == 'heading') {
      echo '<center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;" colspan="2"><font size="4">' .
            $field['heading'] .
            '</font></TD></TR></table>';
    }



AND..

if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
      ';
      foreach ($fielddef as $field) {
        $postbody .= '[color=green][b]' . $field['caption'] . '[/b][/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }

   foreach ($fielddef as $field) {
        $postbody .= '[color=red][b]' . $field['heading'] . '[/b][/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';


but only thing i managed is to have something like 2 forms in one post and one was missing the Question  :). Poor Php skills leads to that i guess, my best guess is that somewhere i need "if" "or" "and", i dont really know  :2funny:

Any help appreciated.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 04, 2009, 02:25:45 PM
Your first change of the code is going to cause real problems because you have messed up the table, starting a new one without closing the old.

This might work:


  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline; color: green;"><font size="4">' .
            $field['heading'] .
            '</font></TD></TR></table></td></tr>';
    }


As for the post, you need an "if". :)

Quote
      foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
        else
          $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
      }
Title: Re: [Done!] Join Us! form
Post by: Inny on February 04, 2009, 04:22:38 PM
Quote from: JPDeni on February 04, 2009, 02:25:45 PM
Your first change of the code is going to cause real problems because you have messed up the table, starting a new one without closing the old.

This might work:


  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline; color: green;"><font size="4">' .
            $field['heading'] .
            '</font></TD></TR></table></td></tr>';
    }


As for the post, you need an "if". :)

Quote
      foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
        else
          $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
      }



Copy/Paste is evil sometimes tho i dont know who to blame more, me for copying from your reply or you for copying from mine  :2funny:

  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline; color: green;"><font size="4">' .
           $field['heading'] .
            '</font></TD></TR></table></td></tr>';
    }


In the above:
$field['heading'] .
should be
$field['caption'] .

It works like a charm besides that copy/paste mistake, that wasted like 20mins of my time till i see it :P. Before that no headings were showed in the form.

Thanks JPDeni.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 04, 2009, 05:04:31 PM
:) Well, you've looked at the code a whole lot more recently than I have. I pretty much have to start over from the beginning when I haven't seen the code for a week or more. This stuff doesn't stick in my head.

Glad you got it worked out. :)
Title: Re: [Done!] Join Us! form
Post by: darrenelkins on February 09, 2009, 09:38:40 PM
HI all,

I need some adivce, I got this script working a treat thanks very much, however I get this error on every submit:

"Connection Problems
Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later."

It does not even reach the Thank You article, however it is adding the posts and emailing me the applications.

I have not altered the code other than simple text and email address, so no point in pasting it all again :)

Cheers
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 09, 2009, 09:41:22 PM
If it's adding the posts, then it is able to access the database. There's something happening after the submit button is pushed. I don't know what it could be, though.
Title: Re: [Done!] Join Us! form
Post by: darrenelkins on February 09, 2009, 11:04:26 PM
Quote from: JPDeni on February 09, 2009, 09:41:22 PM
If it's adding the posts, then it is able to access the database. There's something happening after the submit button is pushed. I don't know what it could be, though.

hmm, ok I have added my the script, just in case something is not right.

Thanks.

---


if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for Wisdom and Strength.';
} else  { // remove closing bracket


global $sourcedir, $user_info, $context ; $scripturl ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment staff member
$email_address='xxxx';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=15.0;

//the id of the this article
$this_article_id = '14';

//article to be redirected when form is submitted
$thank_you_article_id = '13';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';

// Check for an location
if (empty($_POST['location']) ){
$enroll_errors[] = 'You forgot to enter your location.';
}
   
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}

// Check for an class
if (empty($_POST['class']) ){
$enroll_errors[] = 'You forgot to enter your class.';
}

// Check for an race
if (empty($_POST['race']) ){
$enroll_errors[] = 'You forgot to enter your race.';
}

// Check for an level
if (empty($_POST['level']) ){
$enroll_errors[] = 'You forgot to enter your level.';
}

// Check for an professions
if (empty($_POST['professions']) ){
$enroll_errors[] = 'You forgot to enter your professions.';
}

// Check for an attunements
if (empty($_POST['attunements']) ){
$enroll_errors[] = 'You forgot to enter your attunements.';
}

// Check for an playtime
if (empty($_POST['playtime']) ){
$enroll_errors[] = 'You forgot to enter your playtimes.';
}

// Check for an talents
if (empty($_POST['talents']) ){
$enroll_errors[] = 'You forgot to enter your talents.';
}

// Check for an ventrilo
if (empty($_POST['ventrilo']) ){
$enroll_errors[] = 'You forgot to enter your ventrilo question.';
}

// Check for an pvp
if (empty($_POST['pvp']) ){
$enroll_errors[] = 'You forgot to enter your pvp.';
}

// Check for an contribution
if (empty($_POST['contribution']) ){
$enroll_errors[] = 'You forgot to enter your contribution question.';
}

// Check for an why
if (empty($_POST['why']) ){
$enroll_errors[] = 'You forgot to enter why you want to join us.';
}                   
    }

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Name: ' . $_POST['name'] . '
Email address: ' . $_POST['email'] . '
Location: ' . $_POST['location'] . '
Gender: ' . $_POST['gender'] . '
Age: ' . $_POST['age'] . '
Class: ' . $_POST['class'] . '
Race: ' . $_POST['race'] . '
Level: ' . $_POST['level'] . '
Professions[/b]: ' . $_POST['professions'] . '
Attunements: ' . $_POST['attunements'] . '
Playtime: ' . $_POST['playtime'] . '
Talents: ' . $_POST['talents'] . '
TS: ' . $_POST['ventrilo'] . '
PvP: ' . $_POST['pvp'] . '
CTprofile: ' . $_POST['ctprofile'] . '
Contribution: ' . $_POST['contribution'] . '
Why do you want to join our guild? ' . $_POST['why'] . '
Other information: ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Gender:<td></td><td>  ' . $_POST['gender'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Class:<td></td><td> ' . $_POST['class'] . '</td></tr>
<tr><td>Race:<td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>Level:<td></td><td> ' . $_POST['level'] . '</td></tr>
<tr><td>Professions:<td></td><td>  ' . $_POST['professions'] . '</td></tr>
<tr><td>Attunements:<td></td><td>  ' . $_POST['attunements'] . '</td></tr>
<tr><td>Playtime:<td></td><td>  ' . $_POST['playtime'] . '</td></tr>
<tr><td>Talents:<td></td><td>  ' . $_POST['talents'] . '</td></tr>
<tr><td>TS:<td></td><td>  ' . $_POST['ventrilo'] . '</td></tr>
<tr><td>PvP:<td></td><td>  ' . $_POST['pvp'] . '</td></tr>
<tr><td>CTprofile:<td></td><td>  ' . $_POST['ctprofile'] . '</td></tr>
<tr><td>Contribution:<td></td><td>  ' . $_POST['contribution'] . '</td></tr>
<tr><td>Why do you wanna join this guild:<td></td><td>  ' . $_POST['why'] . '</td></tr>
<tr><td>Other information:<td></td><td>  ' . $_POST['other']. '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $context['user']['name'] . ' ' . $_POST['level'] . ' ' . $_POST['class'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "200px">Character Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Male">Male</OPTION>
<OPTION value="Female">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Class:</TD>
                                </TD>
<TD><SELECT id="class" name= "class" style="WIDTH: 152px" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Druid">Druid</OPTION>
<OPTION value="Hunter">Hunter</OPTION>
<OPTION value="Mage">Mage</OPTION>
<OPTION value="Paladin">Paladin</OPTION>
<OPTION value="Priest">Priest</OPTION>
<OPTION value="Rogue">Rogue</OPTION>
<OPTION value="Warlock">Warlock</OPTION>
<OPTION value="Warrior">Warrior</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Race:</TD>
                                </TD>
<TD><SELECT id="race" name= "race" style="WIDTH: 152px" value ="';
if (isset($_POST['race'])) echo $_POST['race'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="Dwarf">Dwarf</OPTION>
<OPTION value="Human">Human</OPTION>
<OPTION value="Gnome">Gnome</OPTION>
<OPTION value="Night Elf">Night Elf</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Level:</TD>
<TD><INPUT id ="level" name ="level" type="text" value ="';
if (isset($_POST['level'])) echo $_POST['level'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">What are your professions?</TD>
<TD><INPUT id ="professions" name ="professions" type="text" value ="';
if (isset($_POST['professions'])) echo $_POST['professions'];   
echo '"  /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Which attunements do you have?</TD>
<TD><INPUT id="attunements" name="attunements" type="text" value ="';
if (isset($_POST['attunements'])) echo $_POST['attunements']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">At which times do you play daily?</TD>
<TD><INPUT id="playime" name="playtime" type="text" value ="';
if (isset($_POST['playtime'])) echo $_POST['playtime']; 
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">What is your current talentbuild?</TD>
<TD><INPUT id="talents" name="talents" type="text" value ="';
if (isset($_POST['talents'])) echo $_POST['talents'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="ventrilo" name="ventrilo" style="WIDTH: 160px" value ="';
if (isset($_POST['ventrilo'])) echo $_POST['ventrilo'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Do you PvP often and is this very important to you?</TD>
<TD><INPUT id="pvp" name="pvp" type="text" value ="';
if (isset($_POST['pvp'])) echo $_POST['pvp'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "200px">If you have a CTprofile, then please link it here:</TD>
<TD><INPUT id="ctprofile" name="ctprofile" type="text" value ="';
if (isset($_POST['ctprofile'])) echo $_POST['ctprofile'];   
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">How do you think you can contribute to the guild?</TD>
<TD><TEXTAREA id="contribution" name ="contribution" rows="4" cols="40" value ="';
if (isset($_POST['contribution'])) echo $_POST['contribution'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">Why do you wanna join us?
</TD>
<TD><TEXTAREA id="why" name = "why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];
echo '" ></' . 'TEXTAREA></TD> </TR>

<TR class ="windowbg2">
<TD width = "200px">Any other information you think can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';
} // Closing at the very end of the code



Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 09, 2009, 11:15:26 PM
I put your code in code tags so I could read it.

I didn't write this code, so I can't really tell what's going on. It probably would be best to see if you can contact the original author of the code.
Title: Re: [Done!] Join Us! form
Post by: Inny on February 10, 2009, 03:10:53 PM
Check:
$board_id=15.0;

im not a php expert but the .0 shouldn't be there.

Also try it without:

if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to apply for Wisdom and Strength.';
} else  { // remove closing bracket


and since you have database connection issues i think the problem lies somewhere in here:

// CONFIGURATION SECTION

//send the application by email?
$enable_email=true;

// email address of recruitment staff member
$email_address='xxxx';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=15.0;

//the id of the this article
$this_article_id = '14';

//article to be redirected when form is submitted
$thank_you_article_id = '13';


//END OF CONFIGURATION SECTION

Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 10, 2009, 03:35:30 PM
In looking over it again, I'm wondering if there might be a problem with your "thank you" page. What's on it?
Title: Re: [Done!] Join Us! form
Post by: durgia on February 10, 2009, 04:33:59 PM
Hi!

I looked through the thread and did not see that one option I would like had been designed by anybody yet. If I missed it, I apologize.

I am looking to add in a bit of code so that the form is not only sent to me but a copy is also sent to the person filling out the form, as confirmation that they have registered. I am using a version of the form I found in this thread to allow people to Register for an upcoming event.

I have attached a copy of the code I am using. One of the mandatory fields I have specified is an email address so I thought I could use that info added to the part that already emails me, but I have not had any luck so far.

Please Note: out of necessity I am allowing Guests to use this form and therefor cannot pull the email address out of the user info command.

As an alternative I wondered if I could make the completed form show up on the Thank you page and then they could print it as a type of receipt.

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

$intro_form = "Please use this online registration form to enroll in the Professional Development Day: Generational Differences.";   // Can include html

$thanks_text = "Thank you for registering. "; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      " First Name",
      'name' =>         "fname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      " Last Name",
      'name' =>         "lname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      "Email Address",
      'name' =>         "email",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Mailing Address",
      'name' =>         "address",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
),
    array(
      'caption' =>      "City",
      'name' =>         "city",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
),
    array(
      'caption' =>      "Province",
      'name' =>         "province",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
),
    array(
      'caption' =>      "Postal Code",
      'name' =>         "postal",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
),
    array(
      'caption' =>      "Preferred Date",
      'name' =>         "date",
      'type' =>         "select",
      'options' =>      "May 12,May 13",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "",
      'name' =>         "member",
      'type' =>         "radio",
      'options' =>      "Member ($250),Non-Member ($300)",
      'defaultvalue' => "",
      'required' =>     1
    ), 
    array(
      'caption' =>      "Company",
      'name' =>         "company",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Contact Phone Number (optional)",
      'name' =>         "phone",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Additional Information (optional)",
      'name' =>         "info",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);


//send the application by email?
$enable_email=true;

// email address of staff member
$email_address='testing@testing.org';

//post the application on forum?
$enable_post=false;

//board id to which the application should be posted
$board_id=1;


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment: Testing';
  $body = 'Testing only: Registration has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
                   <table>';
      foreach ($fielddef as $field) {
        $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
      }
      $postbody .= '</table>';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="100%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
    elseif ($field['type'] == 'heading') {
      echo '<TR class ="' . $bg . '">
            <TD colspan="2">' .
            $field['caption'] .
            '</TD></TR>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }
  echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 10, 2009, 05:03:16 PM
This is getting confusing. I'll start putting the person's name in that I'm responding to. I've got one person using one bit of code and having errors and another person using another bit of code who wants more features.

durgia

Looks like, to mail the same thing to the user that you mail to the admin, after


mail($email_address, $subject, $body,"From: " . $user_info['email']);

(BTW, this should be changed to

mail($email_address, $subject, $body,"From: " . $_REQUEST['email']);

because you are allowing guests.)

add


mail($_REQUEST['email'], $subject, $body,"From: " . $email_address);


To add the info to the "thank you" page, change


echo $thanks_text;


to


echo $thanks_text;
echo '<table>';
foreach ($fielddef as $field)
        echo '<tr><td>' . $field['caption'] . '</td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
echo '</table>';
Title: Re: [Done!] Join Us! form
Post by: durgia on February 10, 2009, 07:45:53 PM
you are the best, as always!!

btw (for anybody else using this in the future) there is a small syntax error in the code provided

echo $thanks_text;
echo '<table>';
foreach ($fielddef as $field) {
        echo '<tr><td>' . $field['caption'] . '</td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
echo '</table>';


is missing a bracket and should be

echo $thanks_text;
echo '<table>';
foreach ($fielddef as $field) {
        echo '<tr><td>' . $field['caption'] . '</td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>'; }
echo '</table>';
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 10, 2009, 09:35:13 PM
Sorry 'bout that. :) I actually intended for there not to be an opening bracket. I must have forgotten to delete it.

Glad you figured it out, though, and that it works for you.
Title: Re: [Done!] Join Us! form
Post by: durgia on February 10, 2009, 09:53:11 PM
No need to apologize for helping me, One of these days I will learn enough to do things on my own :)

I actually tried it without the bracket but it made a very strange output that was scattered around, so I think the bracket is needed. At least it works much better with it :)

Thanks again!

Title: Re: [Done!] Join Us! form
Post by: darrenelkins on February 10, 2009, 11:16:46 PM
Quote from: JPDeni on February 10, 2009, 03:35:30 PM
In looking over it again, I'm wondering if there might be a problem with your "thank you" page. What's on it?

Here is what is on my Thank You article, I dont think I have any database issues as all else works fine. Thanks


global $user_info;
echo "
<h3>Thank you for applying, " . $user_info['name'] . "! </h3><br />
<p>Your application has been sent to our recruitment officers by email and also new topic has been created on your behave in  Recruitment Department's forum. <br/>
Our decision will be posted here. You also will receive an email when the decision will be done.<br/>
Please feel free to add any information you want to share with us.<br/>
<br /></p>";

Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 11, 2009, 12:06:22 AM
Shaktii, I just don't know what the problem is. The code uses a function within SMF to write to the database and you say that the post is being added, so the function is being run. I've never seen any problem like that before.
Title: Re: [Done!] Join Us! form
Post by: darrenelkins on February 11, 2009, 08:21:17 AM
Quote from: JPDeni on February 11, 2009, 12:06:22 AM
Shaktii, I just don't know what the problem is. The code uses a function within SMF to write to the database and you say that the post is being added, so the function is being run. I've never seen any problem like that before.

:( ok, I will simply have to try and find the other recruitment block code that worked for me, it's just that I preferred this look to the other I had, damn, I wish I kept the code now :(

Thanks for your time.
Title: Re: [Done!] Join Us! form
Post by: Inny on February 11, 2009, 09:50:15 AM
Is there any chance to get with an easy way the option to upload files as attachment within a field?
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 11, 2009, 02:10:25 PM
Shaktii, try this. Instead of


// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);


use


// print out thank you
echo "
<h3>Thank you for applying, " . $user_info['name'] . "! </h3><br />
<p>Your application has been sent to our recruitment officers by email and also new topic has been created on your behave in  Recruitment Department's forum. <br/>
Our decision will be posted here. You also will receive an email when the decision will be done.<br/>
Please feel free to add any information you want to share with us.<br/>
<br /></p>";


It occurred to me that the next time the database was being accessed was in printing out that page. Maybe that's where your database problems are located.

Inny, not an easy way, no. :) There are a number of things that would have to be changed, resulting in, pretty much, a completely new script.
Title: Re: [Done!] Join Us! form
Post by: darrenelkins on February 12, 2009, 12:22:22 PM
JPDeni,

I have now got another solution working perfectly, seems to be very similar to the code used in the one that gave me the error.

Thanks for your assistance all the same :)
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 12, 2009, 12:36:26 PM
I'm so glad you got it working. The final result is all that matters.
Title: Re: [Done!] Join Us! form
Post by: durgia on February 19, 2009, 08:57:42 PM
ok... ran into another issue.... is it at all possible to make the "thank you text" contain html (or other format commands) that will not appear in email.

Currently I have some html in my Thank you page and that thank you page is emailed to the "recruitment" member and the person registering with the registration info. When the thank you text is added to the email it shows all code (line breaks, centering etc)

(for the code I am using look back a few posts)


all it really needs to do is center the info and put in some line breaks within the displayed thank you page, but not show the code for it on the emailed thank you page.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 19, 2009, 09:37:50 PM
Just put the html in the variable. You might need to play around with the quotation marks a bit, but since I don't know exactly what you want, I can't tell you for sure.


$thanks_text = '<div style="text-align:center">Thank you for registering.</div>';; // what is displayed after the form is submitted


Toss in line breaks as needed.
Title: Re: [Done!] Join Us! form
Post by: durgia on February 20, 2009, 01:07:24 AM
this is the thank you text:


$thanks_text = " Thank you for registering. This message confirms that you have successfully sent your registration information to the Executive. Until this information has been verified and your payment has been received we cannot guarantee availability. Please forward payment by Cheque or Money Order made out to: aaaaa to the address listed below:

<center><br /><br />aaaa
<br />cbbbbb
<br />cccccccc
<br />ddddddddddddd
<br />1111111111
<br /><br /></center>Your Registration Information is listed below. A copy of this information has been emailed to you for future reference. <br /><br /> ";


the email looks like this:

Registration has been made by  from IP Address 1111111 Thank you for registering. This message confirms that you have successfully sent your registration information to the Executive. Until this information has been verified and your payment has been received we cannot guarantee availability. Please forward payment by Cheque or Money Order made out to: aaaaaaa to the address listed below:

<center><br /><br />aaaa
<br />cbbbbb
<br />cccccccc
<br />ddddddddddddd
<br />1111111111
<br /><br /></center>Your Registration Information is listed below. A copy of this information has been emailed to you for future reference. <br /><br />
              First Name: Final
        Last Name: Test
       Email Address: email@email.com
       Mailing Address: 111
       City: Somewhere
       Province: aaaaa
       Postal Code: aabbaabb
       Preferred Date: May 12
       Cost:    Member ($200)
       Company: hmmm
       Contact Phone Number (optional): 1234567890
       Additional Information (optional): This is a test


so.... ideas are welcome
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 20, 2009, 01:34:54 AM
Then you have changed the code to include the $thanks_text variable into the email, which was not what was in the code you posted before.

If you want me to figure out how to make it work for you, you'll have to repost your code.
Title: Re: [Done!] Join Us! form
Post by: durgia on February 20, 2009, 03:29:05 AM
I don't remember changing it after that, sorry about that!!

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

$intro_form = "Please use this online registration form to enroll in the .";   // Can include html

$thanks_text = " Thank you for registering. This message confirms that you have successfully sent your registration information to the Executive. Until this information has been verified and your payment has been received we cannot guarantee availability. Please forward payment by Cheque or Money Order made out to: lalalalalla to the address listed below:

<center><br /><br />lalalalala
<br />abc 123l
<br />123 4567
<br />aaaa, sssssn
<br />aaaaa
<br /><br /></center>Your Registration Information is listed below. A copy of this information has been emailed to you for future reference. <br /><br /> "; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      " First Name",
      'name' =>         "fname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      " Last Name",
      'name' =>         "lname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
    array(
      'caption' =>      "Email Address",
      'name' =>         "email",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "Mailing Address",
      'name' =>         "address",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
),
    array(
      'caption' =>      "City",
      'name' =>         "city",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
),
    array(
      'caption' =>      "Province",
      'name' =>         "province",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
),
    array(
      'caption' =>      "Postal Code",
      'name' =>         "postal",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
),
    array(
      'caption' =>      "Preferred Date",
      'name' =>         "date",
      'type' =>         "select",
      'options' =>      "May 12,May 13",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Cost: Register by March 31 and Save $50!",
      'name' =>         "member",
      'type' =>         "radio",
      'options' =>      " Member ($250),Non-Member ($300), Early Bird:  Member ($200), Early Bird Non-Member ($250)",
      'defaultvalue' => "",
      'required' =>     1
    ), 
    array(
      'caption' =>      "Company",
      'name' =>         "company",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Contact Phone Number (optional)",
      'name' =>         "phone",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Additional Information (optional)",
      'name' =>         "info",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);


//send the application by email?
$enable_email=true;

// email address of recruitment staff member
$email_address='email@email.com';

//post the application on forum?
$enable_post=false;

//board id to which the application should be posted
$board_id=1;


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Registration: ';
  $body = 'Registration has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . $thanks_text . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $_REQUEST['email']);
mail($_REQUEST['email'], $subject, $body,"From: " . $email_address);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
                   <table>';
      foreach ($fielddef as $field) {
        $postbody .= '<tr><td>' . $field['caption'] . '<td></td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>';
      }
      $postbody .= '</table>';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
echo '<table border="1">';
foreach ($fielddef as $field) {
        echo '<tr><td>' . $field['caption'] . '</td><td>  ' . $_REQUEST[$field['name']] . '</td></tr>'; }
echo '</table>';
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="100%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">

              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '<div style="color: red;">*</div> '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
    elseif ($field['type'] == 'heading') {
      echo '<TR class ="' . $bg . '">
            <TD colspan="2">' .
            $field['caption'] .
            '</TD></TR>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }
  echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 20, 2009, 03:49:58 AM
You'll need to have two different "thanks" messages.

After the current $thanks_text line, add


$thanks_email = 'Thanks'; // This is part of the email message


Change


    if ($enable_email) {  // email an application
  $subject = 'Registration: ';
  $body = 'Registration has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . $thanks_text . '
              ';


to


    if ($enable_email) {  // email an application
  $subject = 'Registration: ';
  $body = 'Registration has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . $thanks_email . '
              ';
Title: Re: [Done!] Join Us! form
Post by: durgia on February 20, 2009, 11:23:54 PM
wow... I deserve a smack in the head.... that is so simple!

I spent a fair bit of time trying to get rid of the code and never even thought once to make 2 separate pieces ...


thank you!
Title: Re: [Done!] Join Us! form
Post by: Xarcell on February 20, 2009, 11:38:55 PM
Quote from: Shaktii on February 09, 2009, 09:38:40 PM
HI all,

I need some adivce, I got this script working a treat thanks very much, however I get this error on every submit:

"Connection Problems
Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later."

It does not even reach the Thank You article, however it is adding the posts and emailing me the applications.

I have not altered the code other than simple text and email address, so no point in pasting it all again :)

Cheers


I've had similar problems, due to extra security provided by the host. Not saying that is the problem here, but with dreamhost I have to remove the extra security to my domains because it's blocks certain characters in the session within the URL.
Title: Re: [Done!] Join Us! form
Post by: Inny on February 22, 2009, 10:14:51 AM
I dont know if anyone else is interested in adding reCaptcha in the form but im trying to add it because im having the form visible by guests because i dont want people registering for just a form.

Providing that you already have an account with reCaptcha and already having reCaptcha for SMF installed you get the following code from reCaptcha's site:


This is the code to display reCaptcha:
require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey);



This is the code to validate reCaptcha:
require_once('recaptchalib.php');
$privatekey = "...";
$resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
  die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
       "(reCAPTCHA said: " . $resp->error . ")");
}


Any help in which part to put the code in JPDeni's form will be greatly appreciated. Im having problems with the validation part of the code.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 22, 2009, 01:54:05 PM
It would go after


if (isset($_REQUEST['submitted'])) {  // Handle the form


I don't know anything about the code, though, so I can't help any more than that.
Title: Re: [Done!] Join Us! form
Post by: Inny on February 24, 2009, 01:53:46 PM
Works like a charm, thanks again.

On a side note the recaptcha box shows in the top of the page. Thats how it is currently.


echo recaptcha_get_html($publickey);
  echo '
     <br><TR class ="' . $bg . '">
      <TD colspan="2" align="center">
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}


If i move

echo recaptcha_get_html($publickey);

i either get a PHP error or not correct validation of the words. Is there any way to make the form appear first? I believe its something to do with the echo' being after the echo for the recaptcha but putting that echo before causes PHP error.

Adding a sampe of my code:
global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');
require_once($sourcedir .'/recaptchalib.php');
$publickey = "........."; // you got this from the signup page





// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you make a post and have to be well written, we still demand that every field that requires a written answer to be well written. </font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      "Email:",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
    array(
      'caption' =>      "Character Info:",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name:",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Lever:",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "70,71,72,73,74,75,76,77,78,79,80",
      'defaultvalue' => "70",
      'required' =>     1
    ),
    array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Orc,Undead,Troll,Tauren,Blood Elf",
      'defaultvalue' => "Orc",
      'required' =>     1
    ),
array(
      'caption' =>      "Class:",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior,Death Knight",
      'defaultvalue' => "Druid",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played:",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Profession 1:",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2:",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
   array(
      'caption' =>      "How are you speced?:",
      'name' =>         "charspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way:",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats:",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Are you willing to respec for the Guild?:",
      'name' =>         "guildspec",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "No",
      'required' =>     1
    ),
array(
      'caption' =>      "Do you have any other Characters?:",
      'name' =>         "otherchars",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Armory Link:",
      'name' =>         "armorylink",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Achievement Points:",
      'name' =>         "achievementpoints",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "About You:",
      'name' =>         "heading2",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Age",
      'name' =>         "charage",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
   array(
      'caption' =>      "Sex:",
      'name' =>         "chargender",
      'type' =>         "select",
      'options' =>      "Male,Female,Yes Please,No Thanks",
      'defaultvalue' => "Yes Please",
      'required' =>     0
    ),
   array(
      'caption' =>      "Are You Emo?:",
      'name' =>         "charemo",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "Yes",
      'required' =>     0
    ),
    array(
      'caption' =>      "Country",
      'name' =>         "charcountry",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Why we should pick you?:",
      'name' =>         "guildpick",
      'type' =>         "textbox",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
   array(
      'caption' =>      "Previous Guilds and why you left?:",
      'name' =>         "guildleave",
      'type' =>         "textbox",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
   array(
      'caption' =>      "Do you have Ventrilo and Mic?:",
      'name' =>         "ventinfo",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "No",
      'required' =>     0
    ),
   array(
      'caption' =>      "Are you vocal in Ventrilo?:",
      'name' =>         "ventvocal",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "No",
      'required' =>     0
    ),
   array(
      'caption' =>      "Have you read the General Guild Rules?:",
      'name' =>         "guildrules",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "No",
      'required' =>     0
    ),
   array(
      'caption' =>      "We expect our members to be familiar with forums. Is this something you are used to?:",
      'name' =>         "charforum",
      'type' =>         "select",
      'options' =>      "Yes,No,Sometimes",
      'defaultvalue' => "No",
      'required' =>     0
    ),
  array(
      'caption' =>      "What can we expect from you, and what do you expect in return?",
      'name' =>         "charexpect",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
  array(
      'caption' =>      "Describe your Connection. Last Disconnect?",
      'name' =>         "coninfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
  array(
      'caption' =>      "Describe your PC Specifications:",
      'name' =>         "pcinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
  array(
      'caption' =>      "UI Print Screen:",
      'name' =>         "uiinfo",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
  array(
      'caption' =>      "Can anyone or anything interfere your online gaming?",
      'name' =>         "interf",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "Yes",
      'required' =>     0
    ),
  array(
      'caption' =>      "If Yes describe:",
      'name' =>         "interfinfo",
      'type' =>         "textbox",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),

);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=34;


//END OF CONFIGURATION SECTION




$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

require_once($sourcedir .'/recaptchalib.php');
$privatekey = "..........";
$resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
  fatal_lang_error('visual_verification_failed', false);
}
else




// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment Application';
  $body = 'Enrollment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }


echo recaptcha_get_html($publickey);
  echo '
     <br><TR class ="' . $bg . '">
      <TD colspan="2" align="center">
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}


The last bit of the code needs some work so recaptcha box appears either after the submit button or before but cant be outside of the </form> tag.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 24, 2009, 02:34:18 PM
The reason it shows in the top is that you have it in the midst of a table, but you don't have it in a table row. The browser doesn't know where to put it, so it puts it on top.

I don't know where you moved the code to and got an error, but this should work:


echo '<TR class ="' . $bg . '"><td colspan="2" align="center">' . recaptcha_get_html($publickey) . '</td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  echo '
     <br><TR class ="' . $bg . '">
      <TD colspan="2" align="center">
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';


This even keeps the alternate colors for the rows, so your form has a unified appearance.
Title: Re: [Done!] Join Us! form
Post by: Inny on February 24, 2009, 02:42:15 PM
Really thanks, i dont know how to thank you but if you ever come to Cyprus (if you know where that is) i will buy coffee for you.  O0
Title: Re: [Done!] Join Us! form
Post by: JPDeni on February 24, 2009, 04:29:51 PM
:D Yes, I know where Cyprus is. :) I would love to come. I understand that it's beautiful.

You're very welcome. If you would like to pay me back, when you see someone who needs a cup of coffee but can't afford it, buy it for him. That would be thanks enough for me. :)
Title: Re: [Done!] Join Us! form
Post by: Inny on March 01, 2009, 11:59:17 AM
I decided to not go with ReCaptcha because you need to have the mod installed in order to work.

So i was working a bit with the code to add SMF visual verification system.

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you make a post and have to be well written, we still demand that every field that requires a written answer to be well written. </font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
    array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Lever",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "70,71,72,73,74,75,76,77,78,79,80",
      'defaultvalue' => "80",
      'required' =>     1
    ),
    array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Orc,Undead,Troll,Tauren,Blood Elf",
      'defaultvalue' => "Orc",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior,Death Knight",
      'defaultvalue' => "Druid",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
   array(
      'caption' =>      "How are you speced?",
      'name' =>         "charspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats and why",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Are you willing to respec for the Guild?",
      'name' =>         "guildspec",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "No",
      'required' =>     1
    ),
array(
      'caption' =>      "Do you have any other Characters?",
      'name' =>         "otherchars",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Armory Link",
      'name' =>         "armorylink",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Achievement Points",
      'name' =>         "achievementpoints",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
    array(
      'caption' =>      "About You",
      'name' =>         "heading2",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Age",
      'name' =>         "charage",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
   array(
      'caption' =>      "Sex",
      'name' =>         "chargender",
      'type' =>         "select",
      'options' =>      "Male,Female,Yes Please,No Thanks",
      'defaultvalue' => "Yes Please",
      'required' =>     0
    ),
   array(
      'caption' =>      "Are You Emo?",
      'name' =>         "charemo",
      'type' =>         "select",
      'options' =>      "Yes,No",
      'defaultvalue' => "Yes",
      'required' =>     0
    ),
    array(
      'caption' =>      "Country",
      'name' =>         "charcountry",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    array(
      'caption' =>      "Why we should pick you?",
      'name' =>         "guildpick",
      'type' =>         "textbox",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
    );



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=34;


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check whether the visual verification code was entered correctly.
if ((empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1) && (empty($_REQUEST['visual_verification_code']) || strtoupper($_REQUEST['visual_verification_code']) !== $_SESSION['visual_verification_code']))
{
$_SESSION['visual_errors'] = isset($_SESSION['visual_errors']) ? $_SESSION['visual_errors'] + 1 : 1;
if ($_SESSION['visual_errors'] > 3 && isset($_SESSION['visual_verification_code']))
unset($_SESSION['visual_verification_code']);

fatal_lang_error('visual_verification_failed', false);
}


// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment Application';
  $body = 'Enrollment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

// Generate a visual verification code to make sure the user is no bot.
$context['visual_verification'] = empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1;
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());

// Only generate a new code if one hasn't been set yet
if (!isset($_SESSION['visual_verification_code']))
{
// Skip I, J, L, O and Q.
$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P'), range('R', 'Z'));

// Generate a new code.
$_SESSION['visual_verification_code'] = '';
for ($i = 0; $i < 5; $i++)
$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
}
}


if ($context['visual_verification'])
{
echo '
<tr>
<td width="40%" align="top" class="windowbg2">
<b>', $txt['visual_verification_label'], ':</b>
<div class="smalltext">', $txt['visual_verification_description'], '</div>
</td>
<td class="windowbg2">';

if ($context['use_graphic_library'])
echo '
<img src="', $context['verificiation_image_href'], '" alt="', $txt['visual_verification_description'], '" id="verificiation_image" /><br />';
else
echo '
<img src="', $context['verificiation_image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verificiation_image_1" />
<img src="', $context['verificiation_image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verificiation_image_2" />
<img src="', $context['verificiation_image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verificiation_image_3" />
<img src="', $context['verificiation_image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verificiation_image_4" />
<img src="', $context['verificiation_image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verificiation_image_5" />';
echo '
<input type="text" name="visual_verification_code" size="30" tabindex="', $context['tabindex']++, '" />

</td>
</tr>';
}


  echo '
     <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}


This is how far i reached and having 2 problems:
1) When you view the application next to the code it says "Not defined yet"
2) If you put the wrong code it breaks your page payout, only problem with my theme is that the footer becomes small
Title: Re: [Done!] Join Us! form
Post by: Inny on March 02, 2009, 12:01:27 AM
Or maybe instead of messing with captcha we can get a box that only accepts a specific number or a phrase for anti-spam.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 02, 2009, 12:22:20 AM
So you're wanting some specific captcha thing to be incorporated into the script?

Wouldn't it be easier to just have people register before they fill out the form?
Title: Re: [Done!] Join Us! form
Post by: Inny on March 02, 2009, 09:27:49 AM
Quote from: JPDeni on March 02, 2009, 12:22:20 AM
So you're wanting some specific captcha thing to be incorporated into the script?

More specifically i want an anti-bot measure. From what i can think i can go along with the captcha or as said on my latest reply maybe a box that accepts only specific value that can hold a question like "Are you a bot" but you have to put the number 1137 in order to proceed with the application.

Quote from: JPDeni on March 02, 2009, 12:22:20 AM
Wouldn't it be easier to just have people register before they fill out the form?

Much much more easier but because its a Guild Community, forums only serve the people inside the guild along with some outside friends.




In the code i posted Here (http://www.tinyportal.net/index.php/topic,9840.msg228188.html#msg228188) captcha works. I also fixed the 1st problem, only problem left is that it "breaks" your theme if the key is not entered correctly.

So if that cant be fixed i can use a box as said above that accepts only specific value.

Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 02, 2009, 04:06:30 PM
Well, "captcha" can mean a lot of different things. It stands for ""Completely Automated Public Turing test to tell Computers and Humans Apart." So that would mean it's an anti-bot measure. :)

It's easy enough, I guess to put in something like "What's three plus four? (enter a number)" The thing is that it would be the same all the time, which seems to defeat the purpose.

The other day I found one that had several pictures of actors and the question was which one was  "Brad Pitt". Depending on the subject of your forum, you could do something like that.

Or you could have the new people sign up for an account. After they fill out the form and are approved, they would have full member status. Forum posts would only be readable by those with full member status.
Title: Re: [Done!] Join Us! form
Post by: Inny on March 02, 2009, 04:45:51 PM
I prefer captcha but because you need to do some more modifications i can forget the idea and go along the ones that you said, like a mathematical box. Im pretty sure the person that is responsible to alter the form can change the the formula aswell :p

But yeah if you look at the code i posted you might find where the problem is and it breaks the layout of the page. Have no clue how to fix it no matter what i tried. On the other hand.... php is not my strong point :P.

Wish it was an html form :(
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 02, 2009, 06:49:59 PM
The reason that it breaks the form is that it is looking for an SMF template sort of page instead of a TP article sort of page and the php article isn't reloaded.

I hate just about more than anything to program in the dark -- to write code without being able to test it out myself -- but I'm going to give you something to try.

Instead of


if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check whether the visual verification code was entered correctly.
if ((empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1) && (empty($_REQUEST['visual_verification_code']) || strtoupper($_REQUEST['visual_verification_code']) !== $_SESSION['visual_verification_code']))
{
$_SESSION['visual_errors'] = isset($_SESSION['visual_errors']) ? $_SESSION['visual_errors'] + 1 : 1;
if ($_SESSION['visual_errors'] > 3 && isset($_SESSION['visual_verification_code']))
unset($_SESSION['visual_verification_code']);

fatal_lang_error('visual_verification_failed', false);
}


// Check required fields
  $errors = array(); //Initialize error array


try


if (isset($_REQUEST['submitted'])) {  // Handle the form
  $errors = array(); //Initialize error array
// Check whether the visual verification code was entered correctly.
if ((empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1) && (empty($_REQUEST['visual_verification_code']) || strtoupper($_REQUEST['visual_verification_code']) !== $_SESSION['visual_verification_code']))
{
$_SESSION['visual_errors'] = isset($_SESSION['visual_errors']) ? $_SESSION['visual_errors'] + 1 : 1;
if ($_SESSION['visual_errors'] > 3 && isset($_SESSION['visual_verification_code']))
unset($_SESSION['visual_verification_code']);

$errors[] = 'Visual verification failed';
}


// Check required fields


I don't know if it'll work or not, but it might.
Title: Re: [Done!] Join Us! form
Post by: Inny on March 02, 2009, 08:41:50 PM
Yeah it doesnt work because you cant pass the Required field check for a reason even if you fill all the info.  :(
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 02, 2009, 11:04:25 PM
I'm not sure what that means. Are you saying that the fields don't fill back in if you don't pass the verification? Or something else?

You do realize that that the SMF verification doesn't really work, right? If you mess up the verification, the "I agree" button doesn't work right when you go back.

I don't know enough about how they wrote the verification to be able to make any more suggestions about it. The only suggestion I have is to use something other than the SMF verification that I already mentioned.
Title: Re: [Done!] Join Us! form
Post by: Inny on March 02, 2009, 11:20:22 PM
Quote from: JPDeni on March 02, 2009, 11:04:25 PM
I'm not sure what that means. Are you saying that the fields don't fill back in if you don't pass the verification? Or something else?

You do realize that that the SMF verification doesn't really work, right? If you mess up the verification, the "I agree" button doesn't work right when you go back.

I don't know enough about how they wrote the verification to be able to make any more suggestions about it. The only suggestion I have is to use something other than the SMF verification that I already mentioned.

No i mean that even if you fill the Required Fields in the form and you press Submit, it always asks to fill the Required Fills even if they were filled before submitting them.

It seems that im gonna go with your suggestions and mathematical boxes :P.

Gonna google for the php code for them, only question if of course i find the correct code: Should i create a new type in:

//       'type' =>         "", // text, radio, select, checkbox, textarea, heading

and then make it appear just every other type?
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 02, 2009, 11:46:36 PM
Actually, I would create a completely separate field and put it just before the submit button.




  echo '
     <TR class ="' . $bg . '"><td>What is five plus seven? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';


Then, in the place where you're checking, include

    if (!isset(_$REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      error[] = 'You didn't get the math problem correct';
Title: Re: [Done!] Join Us! form
Post by: Inny on March 03, 2009, 02:19:41 PM

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');





// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you make a post and have to be well written, we still demand that every field that requires a written answer to be well written. </font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
    array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Lever",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "70,71,72,73,74,75,76,77,78,79,80",
      'defaultvalue' => "80",
      'required' =>     1
    ),
    array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Orc,Undead,Troll,Tauren,Blood Elf",
      'defaultvalue' => "Orc",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior,Death Knight",
      'defaultvalue' => "Druid",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
   array(
      'caption' =>      "How are you speced?",
      'name' =>         "charspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats and why",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=34;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

      if (!isset(_$REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      error[] = 'You didn't get the math problem correct';

// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }



// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment Application';
  $body = 'Enrollment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is five plus seven? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}


Gives syntax error in:

  if (!isset(_$REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      error[] = 'You didn't get the math problem correct';
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 03, 2009, 02:26:28 PM
Typo

_$REQUEST['mathtest'] should be $_REQUEST['mathtest']
Title: Re: [Done!] Join Us! form
Post by: IchBin on March 03, 2009, 03:06:59 PM
Also, this line should be changed:

error[] = 'You didn't get the math problem correct';


To this:
error[] = 'You didn\'t get the math problem correct';
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 03, 2009, 03:21:42 PM
Oh, yeah. :)
Title: Re: [Done!] Join Us! form
Post by: Inny on March 03, 2009, 03:29:18 PM
Hope you like brainteasers :P


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');





// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you make a post and have to be well written, we still demand that every field that requires a written answer to be well written. </font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
    array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Lever",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "70,71,72,73,74,75,76,77,78,79,80",
      'defaultvalue' => "80",
      'required' =>     1
    ),
    array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Orc,Undead,Troll,Tauren,Blood Elf",
      'defaultvalue' => "Orc",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior,Death Knight",
      'defaultvalue' => "Druid",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
   array(
      'caption' =>      "How are you speced?",
      'name' =>         "charspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats and why",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=34;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      error[] = 'You didn\'t get the math problem correct';

// Check required fields
  $errors = array(); //Initialize error array

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }



// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment Application';
  $body = 'Enrollment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is five plus seven? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}


Still giving syntax error. (syntax error, unexpected '[') at       if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      error[] = 'You didn\'t get the math problem correct';


(hope im not being dumb here :()
Title: Re: [Done!] Join Us! form
Post by: IchBin on March 03, 2009, 03:53:13 PM
A couple of things:
Change this:
if (isset($_REQUEST['submitted'])) {  // Handle the form

      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      error[] = 'You didn\'t get the math problem correct';

// Check required fields
  $errors = array(); //Initialize error array


To this:
if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check required fields
  $errors = array(); //Initialize error array

      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn\'t get the math problem correct';
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 03, 2009, 04:39:24 PM
I'm going to post the whole thing that does not give an error message. In one of my test sites, escaping the apostrophe doesn't work, and it may be the same in other places as well. This will work.


global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');





// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you make a post and have to be well written, we still demand that every field that requires a written answer to be well written. </font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
    array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
    array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Lever",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "70,71,72,73,74,75,76,77,78,79,80",
      'defaultvalue' => "80",
      'required' =>     1
    ),
    array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Orc,Undead,Troll,Tauren,Blood Elf",
      'defaultvalue' => "Orc",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior,Death Knight",
      'defaultvalue' => "Druid",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
   array(
      'caption' =>      "How are you speced?",
      'name' =>         "charspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats and why",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='grkronos@gmail.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=34;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form

// Check required fields
  $errors = array(); //Initialize error array

      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn' . "'" . 't get the math problem correct';


// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Enrollment Application';
  $body = 'Enrollment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is five plus seven? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}
Title: Re: [Done!] Join Us! form
Post by: Inny on March 03, 2009, 04:59:13 PM
@IchBinâ„¢

Your code works, form works but if you dont put the correct number the Error message "You didn't get the math problem correct" doesnt come up but it instead asks to fill all the required fields. If filled with the correct number it "works" like a charm.

@JPDeni

It completely skips the required field check if you fill the number (only) correctly and leave the required fields empty. Otherwise "works".

Help appreciated  :D
Title: Re: [Done!] Join Us! form
Post by: JPDeni on March 03, 2009, 05:18:31 PM
Sorry. It's there in your original code. I don't know what happened to it. I'll post the right code. Again. :)



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
  $errors = array(); //Initialize error array
      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn' . "'" . 't get the math problem correct';

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well



Now I'll go put the whole thing into my test site again to make sure there are no errors.

ETA: I got no errors.
Title: Re: [Done!] Join Us! form
Post by: Inny on March 03, 2009, 05:38:28 PM
Yeah it works for me, i just dont get the error massage for the math test if not entered correctly.

It doesnt bother me at all as it is :p

Thanks again for help :)
Title: Re: [Done!] Join Us! form
Post by: GreenX on April 05, 2009, 11:53:31 PM
I have a small problem:

I changed to 10.0 which is my board I want the app to post to:

//board id to which the application should be posted
$board_id=10.0;

After I submit the form to test I get this error:

Page request Error
The page you have requested does not exist.

Anyone have an idea? Thanks!
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 06, 2009, 12:33:15 AM
Try using


$board_id=10;


If that doesn't work, then you'll need to give us the URL that shows up in your browser when you get the error. It's hard to know why something doesn't work unless I can see it.
Title: Re: [Done!] Join Us! form
Post by: GreenX on April 06, 2009, 12:38:56 AM
I deleted that line and it works now, dunno why but it does  :D

New question, I tried various methods but how do I make this line:


   $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $context['user']['name'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),


Instead of doing what it does now "[Pending] Application of FORUM ACCOUNT NAME" as teh subject of the post to:

[Pending] Application from array[charname] array[charclass]

as the subject?

Thanks!
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 06, 2009, 03:25:57 PM
Try


'subject' => '[Pending] Application of ' . $_REQUEST['charname' . ' ' . $_REQUEST['charclass'],
Title: Re: [Done!] Join Us! form
Post by: GreenX on April 06, 2009, 10:37:41 PM
That worked, your the greatest. One last thing

I stuck this at the very top before globals and it doesn't seem to show the message to guests. What am I missing?



if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registered on the site in order to apply.';
} else  {


I just want when the article is viewed to check it they are a guest , if so show them that message.

Thanks!
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 06, 2009, 10:45:17 PM
Your $context array is only available to use after the global line. So pull the global line out of where it is and stick it at the very top and you should be fine. Don't forget your ending } ! :)

Glad to help.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 06, 2009, 11:19:54 PM
The only way to debug it is if I can see the code.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 15, 2009, 08:43:30 AM
Ok decided to give this code a try.... here is the code I am currently using.

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitement@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;

//the id of the this article
$this_article_id = '4';

//article to be redirected when form is submitted
$thank_you_article_id = '2';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}
// Check for a name
if (empty($_POST['game_name']) ){
$enroll_errors[] = 'You forgot to enter your In-Game Name.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';


if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['game_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Race: ' . $_POST['race'] . '
Class: ' . $_POST['class'] . '
Primary Talent Spec:  ' . $_POST['spec'] . '
Secondary Talent Spec:  ' . $_POST['spec2'] . '
Armory Link:  ' . $_POST['armory'] . '
Willing to respec?:  ' . $_POST['respec'] . '
Previous Guild(s):  ' . $_POST['prev_guilds'] . '
Game Experience:  ' . $_POST['experience'] . '
Availability: ' . $_POST['availability'] . '
What can you offer Dark Aftermath?  ' . $_POST['why'] . '
What can Dark Aftermath do for you?  ' . $_POST['why2'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Member Referral:  ' . $_POST['referral'] . '
Other information:  ' . $_POST['other'] .'
Guild Rules: ' . $_POST['rules'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['game_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Race:<td></td><td> ' . $_POST['race'] . '</td></tr>
<tr><td>Class:<td></td><td> ' . $_POST['class'] . '</td></tr>
<tr><td>Primary Talent Spec: <td></td><td> ' . $_POST['spec'] . '</td></tr>
<tr><td>Secondary Talent Spec: <td></td><td> ' . $_POST['spec2'] . '</td></tr>
<tr><td>Armory Link: <td></td><td> ' . $_POST['armory'] . '</td></tr>
<tr><td>Willing to respec?: <td></td><td> ' . $_POST['respec'] . '</td></tr>
<tr><td>Previous Guild(s): <td></td><td> ' . $_POST['prev_guilds'] . '</td></tr>
<tr><td>Game Experience: <td></td><td> ' . $_POST['experience'] . '</td></tr>
<tr><td>Availability: <td></td><td>' . $_POST['availability'] . '</td></tr>
<tr><td>What can you offer Dark Aftermath? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>What can Dark Aftermath do for you? <td></td><td> ' . $_POST['why2'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Member Referral:<td></td><td>  ' . $_POST['referral'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
<tr><td>Guild Rules: <td></td><td>' . $_POST['rules'] . '</td></tr>
</table>';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
                'subject' => '[Pending] Application of ' . $_REQUEST['game_name'] . ' ' . $_REQUEST['class'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://www.darkaftermathguild.com/forums/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />

<br><center>Please take your time to fill out the form.  This is your first impression, so make it a good one.</center><br>

<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "250px">* Your Name:</TD>
<TD><INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">* In-game Name:</TD>
<TD><INPUT id="game_name" name="game_name" type="text" value ="';
if (isset($_POST['game_name'])) echo $_POST['game_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">* Age:</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">Gender:
</TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 152px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
<OPTION value="Male">Male</OPTION>
<OPTION value="Female">Female</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">Location:</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];   
echo '" /></TD>
</TR>
                                <TR class ="windowbg">
        <TD width = "250px">Race:
</TD><TD><SELECT id = "race" name = "race" style="WIDTH: 152px" value ="';
if (isset($_POST['race'])) echo $_POST['race'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
<OPTION value="Draenei">Draenei</OPTION>
<OPTION value="Dwarf">Dwarf</OPTION>
<OPTION value="Gnome">Gnome</OPTION>
<OPTION value="Human">Human</OPTION>
<OPTION value="Night Elf">Night Elf</OPTION>
</SELECT></TD>
</TR>
                                 <TR class ="windowbg">
         <TD width = "250px">Class:
</TD>
<TD><SELECT id = "class" name = "class" style="WIDTH: 152px" value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
                                                <OPTION value="Death Knight">Death Knight</OPTION>
<OPTION value="Druid">Druid</OPTION>
<OPTION value="Hunter">Hunter</OPTION>
<OPTION value="Mage">Mage</OPTION>
<OPTION value="Paladin">Paladin</OPTION>
<OPTION value="Priest">Priest</OPTION>
                                                <OPTION value="Rogue">Rogue</OPTION>
<OPTION value="Shaman">Shaman</OPTION>
<OPTION value="Warlock">Warlock</OPTION>
<OPTION value="Warrior">Warrior</OPTION>
</SELECT></TD>
</TR>
                        <TR class ="windowbg">
<TD width = "250px">Primary Talent Spec:</TD>
<TD><INPUT id="spec" name="spec" type="text" value ="';
if (isset($_POST['spec'])) echo $_POST['spec'];
echo '" /></TD>
</TR>
                        <TR class ="windowbg">
<TD width = "250px">Secondary Talent Spec:</TD>
<TD><INPUT id="spec2" name="spec2" type="text" value ="';
if (isset($_POST['spec2'])) echo $_POST['spec2'];
echo '" /></TD>
</TR>
                                <TR class ="windowbg">
<TD width = "250px">Willing to respec?":
</TD>
<TD><SELECT id = "respec" name = "respec" style="WIDTH: 152px" value ="';
if (isset($_POST['respec'])) echo $_POST['respec'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
</SELECT></TD>
</TR>
                         <TR class ="windowbg2">
<TD width = "250px">Armory Link:</TD>
<TD><TEXTAREA id="armory" name="armory" rows="1" cols="40" value ="';
if (isset($_POST['armory'])) echo $_POST['armory'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">Previous Guild(s) and reason for leaving:</TD>
<TD><TEXTAREA id="prev_guilds" name="prev_guilds" rows="4" cols="40" value ="';
if (isset($_POST['prev_guilds'])) echo $_POST['prev_guilds'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">Game Experience:</TD>
<TD><TEXTAREA id ="experience" name ="experience" rows="4" cols="40"  value ="';
if (isset($_POST['experience'])) echo $_POST['experience'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">Availability:</TD>
<TD><TEXTAREA id ="availability" name ="availability" rows="4" cols="40"  value ="';
if (isset($_POST['availability'])) echo $_POST['availability'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">What can you offer Dark Aftermath?</TD>
<TD><TEXTAREA id="why" name ="why" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">What can Dark Aftermath do for you?</TD>
<TD><TEXTAREA id="why2" name ="why2" rows="4" cols="40" value ="';
if (isset($_POST['why2'])) echo $_POST['why2'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "250px">Tell us about your gaming habbits:
</TD>
<TD><TEXTAREA id="habbits" name="habbits" rows="4" cols="40" value ="';
if (isset($_POST['habbits'])) echo $_POST['habbits'];
echo '" ></' . 'TEXTAREA></TD>
</TR>
                        <TR class ="windowbg2">
<TD width = "250px">Member Referral:</TD>
<TD><INPUT id="referral" name="referral" type="text" value ="';
if (isset($_POST['referral'])) echo $_POST['referral'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "250px">Any other information you think<br>can help us to make a decision:</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
                                <TR class ="windowbg">
<TD width = "250px">I understand, and accept the Guild Rules:
</TD>
<TD><SELECT id = "rules" name = "rules" style="WIDTH: 152px" value ="';
if (isset($_POST['rules'])) echo $_POST['rules'];   
echo '" />
<OPTION value="No Answer" selected>----Please Select----</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';



and the output is this...

Enrollment application has been made by admin_Gyza























Real Name:                      Jason
Email address:              admin@darkaftermath.org
Current Game Name:           Gyza
Age:                              33
Gender:                     Male
Location:                      Arizona
Race:                            Human
Class:                    Paladin
Primary Talent Spec:          Retribution
Secondary Talent Spec:      Protection
Armory Link:             test1
Willing to respec?:          yes
Previous Guild(s):          test2
Game Experience:          test3
Availability:             test4
What can you offer Dark Aftermath?       test5
What can Dark Aftermath do for you?       test6
Gaming habbits:             test7
Member Referral:              test8
Other information:              test9
Guild Rules:              yes

So the overall code is working.  But there is a large gap at the top, and some of the answers do not line up.  I exagerated them here, but it is maybe a space or 2 on the post.

Also is there a way to ask for an applicant to log into SMF before posting?  Right now I can apply with no login.  Either a login or a visual confirm at the bottom of the app or something?  If not I can deal with is.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 15, 2009, 03:06:37 PM
I would suggest taking out the <br  /> in


$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>


I'm not sure what you mean by "some of the answers to not line up." Are you talking about lining up nicely in vertical columns? If so, the problem is likely due to there being html in the code but you have not allowed html in your posts. You can change it, though.

Wherever you see < > brackets in the table structure, change them to [ ] brackets. Like this:


$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
[table]
[tr][td]Real Name:[/td][td]  ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td]  ' . $_POST['email'] . '[/td][/tr]


Also I noticed that there were some duplicated tags which might be messing up your table.

Notice

<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>


There's an extra <td> tag after the label. I think it's on every row. You can try taking out the extra one first and see if that works before going to the trouble of editing all the brackets.

QuoteAlso is there a way to ask for an applicant to log into SMF before posting?  Right now I can apply with no login.  Either a login or a visual confirm at the bottom of the app or something?  If not I can deal with is.

I thought that was part of it.

If you have the most recent version of TP, you should be able to select which groups it's visible to. If not, right after


global $sourcedir, $user_info, $context ;


add


if ($user_info['id'] == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {


and (very important!!) at the very end of the code, add


}
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 15, 2009, 07:30:39 PM
@JPDeni - I took out the <br />and it lessened the gap, but not by much.

I then went into the admin panel and enabled basic HTML....which didnt help
I then took out all the extra <td> that you mentioned, all that did was put all my answers in the top gap, and the questions below....or vice versa I dont remember.
I then started changing the <table> to [table] and that really messed things up and put alot of code on the output of the form.....

So....I was looking around and found that you posted your original code.  It is alot closer to what I had before (infact I think we talked about that in my other thread).  I upgraded to Tinyportal beta 1 (or whatever the newest was yesterday) and it looked really good.

I liked the output of the form alot better, and I am more familiar with editing it since that is the one I used before. 

I did see an error in your post above tho.... ['charname'] you listed as ['charname' 

Took me awhile to find that one!!   ;D

I will be looking to add the login info edit you posted, and I really like the math problem as a way to verify someone is at the keyboard,  ;)
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 15, 2009, 07:34:27 PM
Oh, well, I always make a lot of mistakes. It just comes with the territory. :)

If you have any problems with the other code, post in that topic. Things get really confused enough as it is. :)
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 15, 2009, 07:55:23 PM
Quote from: JPDeni on April 15, 2009, 07:34:27 PM
Oh, well, I always make a lot of mistakes. It just comes with the territory. :)

If you have any problems with the other code, post in that topic. Things get really confused enough as it is. :)

I decided to use the code you posted on page 34 of this topic.  Then made the modification to the subject line so it posts the character name not the log in name.  So far it is working, I am just adding things to it and changing it to Alliance
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 15, 2009, 08:10:23 PM
Okay. :) Obviously, I'm the one who is most confused!! :2funny:
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 16, 2009, 02:14:40 AM
if ($user_info['id'] == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {


Using that code right after the global, and putting the } at the end of the total code gives this error...

Parse error: syntax error, unexpected $end in /home/darkaft1/public_html/forums/Sources/Load.php(1735) : eval()'d code(1080) : eval()'d code on line 336
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 16, 2009, 02:25:36 AM
I can only debug the whole code, I'm afraid. You'll need to post it so I can see what the problem is.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 16, 2009, 08:06:56 AM
Here is the 'working' code.

global $sourcedir, $user_info, $context ;


require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you are used too, we still expect that every field that requires a written answer to be well written.<p>Please take the time to fill out each field, as this is your first impression to the guild.</p></font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
       array(
      'caption' =>      "Personal Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "Name",
      'name' =>         "realname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1  
    ),
array(
      'caption' =>      "Age",
      'name' =>         "age",
      'type' =>         "select",
      'options' =>      "18,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
      'defaultvalue' => "18",
      'required' =>     1
    ), 
       array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1  
    ),
array(
      'caption' =>      "Level",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "80,79,78,77,76,75,74,73,72,71",
      'defaultvalue' => "80",
      'required' =>     1
    ),
array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Draenei,Dwarf,Gnome,Human,Night Elf",
      'defaultvalue' => "Draenei",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Death Knight,Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior",
      'defaultvalue' => "Death Knight",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1  
    ),
       array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Primary Spec?",
      'name' =>         "primaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Secondary Spec?",
      'name' =>         "secondaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Armory Link?",
      'name' =>         "armory",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats and why",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
       array(
      'caption' =>      "Additional Questions",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "What can you offer Dark Aftermath?",
      'name' =>         "offer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you looking for in Dark Aftermath?",
      'name' =>         "looking",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Any added information to help us make a decision?",
      'name' =>         "decision",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Member Referral?",
      'name' =>         "referral",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitment@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
  $errors = array(); //Initialize error array
      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn' . "'" . 't get the math problem correct';

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Recruitment Application';
  $body = 'Recruitment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';  
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';  
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }   
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is 5 + 7? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}


I wanted to do two things and this will be done. 

1.  How do I add the code

if ($user_info['id'] == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {


2.  Is there a way for me to make the 'textarea' fields post under the question and not to the side of it?  Or any input field for that matter.

I should also note how I am making this work, just incase it throws off anything.

I have this installed into an article in Tinyportal 1 with all the panels turned off.
I have a portal (eqdkp+) installed with a link to the Tinyportal article. 
It opens the application up inside of Tinyportal/SMF for them to fill out and submit.
Then it posts it and they get a Thank You page. 

So far it is working great other then the things I would like to add.

Oh I should note....I am trying to have some kind of formatting involved with the textarea.  For those people who type a long answer it will format it in a neat way instead of running the width of my browser and then wrapping.  I can move my browser and see the text shrink and make another line.

Not a huge deal overall, but if I can get that working it would be awesome.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 16, 2009, 02:38:10 PM
The following code gives no syntax errors:


global $sourcedir, $ID_MEMBER, $context ;


if ($ID_MEMBER == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you are used too, we still expect that every field that requires a written answer to be well written.<p>Please take the time to fill out each field, as this is your first impression to the guild.</p></font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
       array(
      'caption' =>      "Personal Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "Name",
      'name' =>         "realname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Age",
      'name' =>         "age",
      'type' =>         "select",
      'options' =>      "18,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
      'defaultvalue' => "18",
      'required' =>     1
    ), 
       array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Level",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "80,79,78,77,76,75,74,73,72,71",
      'defaultvalue' => "80",
      'required' =>     1
    ),
array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Draenei,Dwarf,Gnome,Human,Night Elf",
      'defaultvalue' => "Draenei",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Death Knight,Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior",
      'defaultvalue' => "Death Knight",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
       array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Primary Spec?",
      'name' =>         "primaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Secondary Spec?",
      'name' =>         "secondaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Armory Link?",
      'name' =>         "armory",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats and why",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
       array(
      'caption' =>      "Additional Questions",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "What can you offer Dark Aftermath?",
      'name' =>         "offer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you looking for in Dark Aftermath?",
      'name' =>         "looking",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Any added information to help us make a decision?",
      'name' =>         "decision",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Member Referral?",
      'name' =>         "referral",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitment@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
  $errors = array(); //Initialize error array
      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn' . "'" . 't get the math problem correct';

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Recruitment Application';
  $body = 'Recruitment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }   
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is 5 + 7? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}
}


QuoteIs there a way for me to make the 'textarea' fields post under the question and not to the side of it?  Or any input field for that matter.
You'll need to change the form area of the code. The form starts printing just after the comment line


// Looks like you want the form,


There are a series of "if ... elseif" statements, each one dealing with a different type of field. They are designed to print out with the label in one table column and the field in another. If you want to change the way they print out, you'll need to change them here.

For example, to change the way the textarea displays, you might want to change


    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }


to


    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD colspan="2">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . '<br />
            <TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }


Look closely at the changes that I made -- I changed the


<TD width = "200px" align="right">';


line to


<TD colspan="2">';


Then I changed


':</TD>
            <TD align="left">


to


'<br />


You have to be very careful when you're doing this or you will mess up the single quotes that make everything work.

If you have trouble with it, let me know if you want them all to be this way or just the textarea and I'll do it for you.

I haven't a clue about eqdkp+. I had never heard of it until you mentioned it.

QuoteOh I should note....I am trying to have some kind of formatting involved with the textarea.  For those people who type a long answer it will format it in a neat way instead of running the width of my browser and then wrapping.

I'm not sure where you are talking about. Is this in the post that the form creates? You can do some playing around with putting in line breaks in the nearest space before a certain number of characters, I guess.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 16, 2009, 04:24:58 PM
I managed to get the 'field' box done properly, but the 'radio', 'checkbox' and all the others are giving me syntax errors for some reason.  Is there more/less I should be adding to these ones that are different?

edit:  the 'textarea' is also done properly.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 16, 2009, 04:38:57 PM
I don't think there's anything different (I haven't looked closely yet), but it can get pretty hinky with the quotation marks. You have the text box and textarea, yes? I'll go through the rest.


    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD colspan="2">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . '<br />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD colspan="2">';
              echo $field['caption'] . '<br />';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD colspan="2">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . '<br />
<SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }   


That should do it. I realize now that I should have set it up differently so you'd only have to change one thing. It's all an evolution. :)
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 16, 2009, 07:30:02 PM
Well that did work, but not the expected result.  I totally did not notice this was changing the application itself.  I was looking to change the output (post) of the application.

What I was looking for was all the 'text' or anything that had the smaller input boxes to post with the answer to the right of the question.

Any boxes with alot of text....I think the 'textarea' ones would have the question and the information the people enter would be below the question and not to the right of it. 

Not sure that makes sense, but I am trying to tidy up the actual posted application so it is uniform and looks good.  As it stands now if someone types a really long sentence it doesnt auto wrap to the next line.  It will keep going as wide as your browser will go. 

Also looking at the new changes in the app....it doesnt look as good as before.  Is there a way to make it appear similiar to above, but keep all the questions lined up properly?  Not sure if there is or not.   But the main concern is the output of the answers. 
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 16, 2009, 07:44:03 PM
Oh. You were talking about changing what goes into the post after the form is submitted. I thought you wanted to change the way the form looks. I was going to try to tell you how to do things, but I don't know what it is that you want.

QuoteAs it stands now if someone types a really long sentence it doesnt auto wrap to the next line.

Yes. They are just like every other post that is in your forum. What do you want?

QuoteAlso looking at the new changes in the app....it doesnt look as good as before.  Is there a way to make it appear similiar to above, but keep all the questions lined up properly?

Probably, but I don't know what you mean by "properly." What's "proper" to you may be completely unproper to me.

You will likely have to give me an example in order to be able to tell you how to do what it is that you want to do.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 16, 2009, 08:10:04 PM
I will do my best..I am at work  ::)

In the application I would like all the Questions to be aligned Like this

Name: answer box
Age: answer box
Email: answer box
Why did you choose this spec?:
Answer box
What can you offer Dark Aftermath?:
Answer box
Member Referral: answer box

So basically all the questions are aligned together and neat.  The 'textarea' boxes are positioned below the question where as the smaller answer boxes can be to the right of the question.

On the actual Post I would like it the same way.  But in the text boxes maybe have a certain word limit per line if possible?  So it will see they typed 800 words in 1 sentence and it will auto wrap at lets say 300 words.  So here is what that might look like...

What can you offer Dark Aftermath?:
300 words of an answer
300 words of an answer
200 words of an answer

Maybe that is left justifying everyting?  I would like the table itself to be centered, but all the questions and such to be left justified inside of the table.  Not sure that is a good example or even possible. 

btw, I really appreciate you helping me on this.  Thank you so much!
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 16, 2009, 09:03:28 PM
Quote
The 'textarea' boxes are positioned below the question where as the smaller answer boxes can be to the right of the question.

That goes back to what I gave you earlier, then.

I'll repost it here.


global $sourcedir, $ID_MEMBER, $context ;


if ($ID_MEMBER == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=red>Even if this is nothing like the normal Applications that you are used too, we still expect that every field that requires a written answer to be well written.<p>Please take the time to fill out each field, as this is your first impression to the guild.</p></font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=red>Thanks for applying. Your application has been submitted successfully. We'll review your application and get back to you.</h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
       array(
      'caption' =>      "Personal Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "Name",
      'name' =>         "realname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Age",
      'name' =>         "age",
      'type' =>         "select",
      'options' =>      "18,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
      'defaultvalue' => "18",
      'required' =>     1
    ), 
       array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
  ),
array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Level",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "80,79,78,77,76,75,74,73,72,71",
      'defaultvalue' => "80",
      'required' =>     1
    ),
array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Draenei,Dwarf,Gnome,Human,Night Elf",
      'defaultvalue' => "Draenei",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Death Knight,Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior",
      'defaultvalue' => "Death Knight",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
       array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Primary Spec?",
      'name' =>         "primaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Secondary Spec?",
      'name' =>         "secondaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Armory Link?",
      'name' =>         "armory",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you class important stats and why",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
       array(
      'caption' =>      "Additional Questions",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "What can you offer Dark Aftermath?",
      'name' =>         "offer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you looking for in Dark Aftermath?",
      'name' =>         "looking",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Any added information to help us make a decision?",
      'name' =>         "decision",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Member Referral?",
      'name' =>         "referral",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitment@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
  $errors = array(); //Initialize error array
      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn' . "'" . 't get the math problem correct';

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Recruitment Application';
  $body = 'Recruitment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]<br />';
        else
          $postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . ' </TD>
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT name="' . $field['name'] . '" style="WIDTH: 152px" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }   
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD colspan=2">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':<br />
            <TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is 5 + 7? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}
}


QuoteSo it will see they typed 800 words in 1 sentence and it will auto wrap at lets say 300 words.

I don't think you mean that. There is no way that 300 words would fit onto one line. I don't think that even 300 characters will fit on one line in most browsers. Possibly 30 characters is what you meant.

Also there is not nearly the flexibility with BBC code that there is with html. I can set it up to put things in a table. No problem at all. But things like headings that normally would span two columns just won't work.

If you can set it up in a forum post here, using BBC code the way you want it, I can (probably) figure out how to make the script do it.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 16, 2009, 09:47:45 PM
The word wrap feature I can look at.  300 was just an example to try and show once it reached a certain amount it would go to the next line.  I am not overy code literate, except being able to do edits and things, lol.

I will look at the code you posted, but if it is the same as the other, there was a small issue with it not formatting properly.

I will look when I get home shortly, and if it isnt right I will try to atleast make it look the way I want and post a screenshot so you can see how I am trying to make it look, and see if it is possible to make the code do that.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 16, 2009, 10:06:23 PM
Quotethere was a small issue with it not formatting properly.

What was the issue?
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 17, 2009, 12:18:52 AM
Ok had some time to play around with things.....the application itself will be fine with the login info added.  All I would like is to see if the output can be worked on.  Here is the current code since I changed a few colors around and moved some boxes to make it look better..

global $sourcedir, $ID_MEMBER, $context ;


if ($ID_MEMBER == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=white>Even if this is nothing like the normal Applications that you are used too, we still expect that every field that requires a written answer to be well written.<p>Please take the time to fill out each field, as this is your first impression to the guild.</p></font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=white>Thanks for applying. Your application has been submitted successfully.<br>We'll review your application and get back to you.<p>Typical response time is 24-48 hours.</p>If you are not contacted by then, please message an officer ingame to discuss your application status.<p>Thank You,<br>Dark Aftermath Recruitment</p></h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
       array(
      'caption' =>      "Personal Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "Name",
      'name' =>         "realname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Age",
      'name' =>         "age",
      'type' =>         "select",
      'options' =>      "18,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
      'defaultvalue' => "18",
      'required' =>     1
    ), 
       array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Member Referral",
      'name' =>         "referral",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Level",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "80,79,78,77,76,75,74,73,72,71",
      'defaultvalue' => "80",
      'required' =>     1
    ),
array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Draenei,Dwarf,Gnome,Human,Night Elf",
      'defaultvalue' => "Draenei",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Death Knight,Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior",
      'defaultvalue' => "Death Knight",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
       array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Primary Spec?",
      'name' =>         "primaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Secondary Spec?",
      'name' =>         "secondaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Armory Link?",
      'name' =>         "armory",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
     'caption' =>      "Willing to respec?",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
       array(
      'caption' =>      "Additional Questions",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "What can you offer<br>Dark Aftermath?",
      'name' =>         "offer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you looking<br>for in Dark Aftermath?",
      'name' =>         "looking",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Additional Comments?",
      'name' =>         "decision",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Competency Test",
      'name' =>         "test",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitment@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
  $errors = array(); //Initialize error array
      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn' . "'" . 't get the math problem correct';

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Recruitment Application';
  $body = 'Recruitment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
      foreach ($fielddef as $field) {
        $body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
        ';
      }
      mail($email_address, $subject, $body,"From: " . $user_info['email']);
    }

    if ($enable_post) {  //create new forum post with application

      $postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=white][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
        else
          $postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }   
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is 5 + 7? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}
}


And here is the screen shot of what I was looking for
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.darkaftermathguild.com%2Fapplication_output.jpg&hash=70a521c0518e3567534c370ca22d3a858eaaa2fa)
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 17, 2009, 01:01:59 AM
Okay. This will put the textarea stuff below the label, rather than next to it.


  foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
          $postbody .= '[color=white][u][b]' . $field['caption'] . '[/b][/u][/color]<br />';
        elseif ($field['type'] == 'textarea') {
          $postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]<br />' . $_REQUEST[$field['name']] . '<br />';        }
        else
          $postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
      }


The thing I haven't a clue about is "to only go out as far as the armory link." What is the "armory link" and how can I know how long it is?
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 17, 2009, 01:16:33 AM
Well, with the answers posting under the questions I think this might be good enough.  The idea of the "armory link" was to give an example in the screenshot of how far out I wanted the text to go. 

After looking at it here, I think it might be ok.  Need to get some applications in to see, aswell as a few of the other recruiters.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 17, 2009, 01:27:37 AM
I can't see anything that says "armory link", possibly because I can't read the green text against the dark blue background.

I did create a word wrap function which you can use, though. You can set your own character length.


foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
           $postbody .= '[color=white][u][b]' . $field['caption'] . '[/b][/u][/color]<br />';
        elseif ($field['type'] == 'textarea') {
$text = $_REQUEST[$field['name']];
$length = 30; // maximum length of a line
$output = '';
while (strlen($text) > $length) {
$textlen = strlen($text);
$part = substr($text,0,$length);
$partlen = $length;
while (substr($part,-1) <> ' ') {
$part = substr($part,0,-1);
--$partlen;
}
$output .= $part . '<br />';
$text = substr($text,$partlen,($textlen-$partlen));
}
$output .= $text;
          $postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]<br />' . $output . '<br />';        }
        else
          $postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
}
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 17, 2009, 02:30:32 AM
I added that code, and I get no errors.  However I do not see anything posting on my board at all.  Not even an attempt to post it.

I am getting the thank you for posting though, after I hit submit.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 17, 2009, 03:20:04 AM
It shouldn't have had that effect. I can't guarantee that you put it in the right place.

Please post the code that you have -- the one that doesn't work -- so I can figure out what's wrong.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 17, 2009, 03:40:45 AM
global $sourcedir, $ID_MEMBER, $context ;


if ($ID_MEMBER == 0)
{
    echo 'You must be logged in before you can apply.';
}
else {

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=white>Even if this is nothing like the normal Applications that you are used too, we still expect that every field that requires a written answer to be well written.<p>Please take the time to fill out each field, as this is your first impression to the guild.</p></font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=white>Thanks for applying. Your application has been submitted successfully.<br>We'll review your application and get back to you.<p>Typical response time is 24-48 hours.</p>If you are not contacted by then, please message an officer ingame to discuss your application status.<p>Thank You,<br>Dark Aftermath Recruitment</p></h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
  array(
       array(
      'caption' =>      "Personal Info",
      'name' =>         "heading",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "Name",
      'name' =>         "realname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Age",
      'name' =>         "age",
      'type' =>         "select",
      'options' =>      "18,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
      'defaultvalue' => "18",
      'required' =>     1
    ), 
       array(
      'caption' =>      "Email",
      'name' =>         "charemail",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Member Referral",
      'name' =>         "referral",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Info",
      'name' =>         "heading1",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
array(
      'caption' =>      "Character Name",
      'name' =>         "charname",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
array(
      'caption' =>      "Level",
      'name' =>         "charlevel",
      'type' =>         "select",
      'options' =>      "80,79,78,77,76,75,74,73,72,71",
      'defaultvalue' => "80",
      'required' =>     1
    ),
array(
      'caption' =>      "Race",
      'name' =>         "charrace",
      'type' =>         "select",
      'options' =>      "Draenei,Dwarf,Gnome,Human,Night Elf",
      'defaultvalue' => "Draenei",
      'required' =>     1
    ),
array(
      'caption' =>      "Class",
      'name' =>         "charclass",
      'type' =>         "select",
      'options' =>      "Death Knight,Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior",
      'defaultvalue' => "Death Knight",
      'required' =>     1
    ),
array(
      'caption' =>      "Days played",
      'name' =>         "charplayed",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1   
    ),
       array(
      'caption' =>      "Profession 1",
      'name' =>         "prof1",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Profession 2",
      'name' =>         "prof2",
      'type' =>         "select",
      'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
      'defaultvalue' => "None",
      'required' =>     1
    ),
array(
      'caption' =>      "Primary Spec?",
      'name' =>         "primaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Secondary Spec?",
      'name' =>         "secondaryspec",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Armory Link?",
      'name' =>         "armory",
      'type' =>         "text",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Why you speced this way",
      'name' =>         "specinfo",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
     'caption' =>      "Willing to respec?",
      'name' =>         "specstats",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
       array(
      'caption' =>      "Additional Questions",
      'name' =>         "heading2",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
          ),
array(
      'caption' =>      "What can you offer Dark Aftermath?",
      'name' =>         "offer",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "What are you looking for in Dark Aftermath?",
      'name' =>         "looking",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Additional Comments?",
      'name' =>         "decision",
      'type' =>         "textarea",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     1
    ),
array(
      'caption' =>      "Competency Test",
      'name' =>         "heading3",
      'type' =>         "heading",
      'options' =>      "",
      'defaultvalue' => "",
      'required' =>     0
    ),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitment@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
  $errors = array(); //Initialize error array
      if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
      $errors[] = 'You didn' . "'" . 't get the math problem correct';

  foreach ($fielddef as $field)
    if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
  if (isset($errors[0])) {
    foreach ($_REQUEST as $key => $value)
      $fieldvalue[$key] = $value;
  }
  else { // all is well
 
    $show_form='false';
    if ($enable_email) {  // email an application
  $subject = 'Recruitment Application';
  $body = 'Recruitment application has been made by ' . $context['user']['name'] .
          ' from IP Address ' . $user_info['ip'] . '
              ';
foreach ($fielddef as $field) {
        if ($field['type'] == 'heading')
           $postbody .= '[color=white][u][b]' . $field['caption'] . '[/b][/u][/color]<br />';
        elseif ($field['type'] == 'textarea') {
$text = $_REQUEST[$field['name']];
$length = 30; // maximum length of a line
$output = '';
while (strlen($text) > $length) {
$textlen = strlen($text);
$part = substr($text,0,$length);
$partlen = $length;
while (substr($part,-1) <> ' ') {
$part = substr($part,0,-1);
--$partlen;
}
$output .= $part . '<br />';
$text = substr($text,$partlen,($textlen-$partlen));
}
$output .= $text;
          $postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]<br />' . $output . '<br />';        }
        else
          $postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
}
      $postbody .= '';

      $msgOptions = array(
        'id' =>  0 ,
        'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
        'body' => $postbody ,
        'icon' => 'xx',
        'smileys_enabled' => true,
        'attachments' =>  array(),
      );
      $topicOptions = array(
        'id' => 0 ,
        'board' => $board_id,
        'poll' =>  null,
        'lock_mode' =>  null,
        'sticky_mode' =>  null,
        'mark_as_read' => true,
      );
      $posterOptions = array(
        'id' => $context['user']['id'],
        'name' => $context['user']['name'],
        'email' => $user_info['email'],
        'update_post_count' => true,
      );
      createPost($msgOptions, $topicOptions, $posterOptions);
    }
// Text for thank you page

    echo $thanks_text;
  }
}

// Looks like you want the form,
if ($show_form == 'true') {
  echo $intro_form . "<br>";
  if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
  echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
        <center><table width="50%">';
  $bg = 'windowbg2';
  foreach ($fielddef as $field) {
    if ($field['type'] == 'text') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
            </TR>';
    }
    elseif ($field['type'] == 'radio') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left">';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
                echo '>' . $option . ' ';
              }
              echo '</TD>
            </TR>';   
    }
    elseif ($field['type'] == 'checkbox') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              echo $field['caption'] . ':</TD>
              <TD align="left">';
                echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '
            </TR>';   
    }
    elseif ($field['type'] == 'select') {
      echo '<TR class ="' . $bg . '">
              <TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
              <TD align="left"><SELECT id="' . $field['name'] . '" name="' . $field['name'] . '" style="WIDTH: 152px" value ="';
              echo '" />';
              $options = explode(',',$field['options']);
              foreach ($options as $option) {
                echo '<OPTION value="' . $option . '"';
                if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
                echo '>' . $option . '</OPTION>';
            }
            echo '</SELECT></TD>
            </TR>';
    }   
    elseif ($field['type'] == 'textarea') {
      echo '<TR class ="' . $bg . '">
            <TD width = "200px" align="right">';
            if ($field['required'] == 1) { echo '* '; }
            echo $field['caption'] . ':</TD>
            <TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
            echo $fieldvalue[$field['name']];
            echo '</' . 'TEXTAREA></TD>
  </TR>';
    }
  elseif ($field['type'] == 'heading') {
      echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
            <font size="8"><TD style="text-align: center; text-decoration: underline;"><font size="4">' .
            $field['caption'] .
            '</font></TD></TR></table></center></td></tr>';
    }
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
  }

    echo '
     <TR class ="' . $bg . '"><td>What is 5 + 7? (enter a number)</td>
     <td><input type="text" name="mathtest" value=""></td></tr>';
    if ($bg == 'windowbg2') { $bg = 'windowbg'; }
    else { $bg = 'windowbg2'; }
    echo '
    <TR class ="' . $bg . '">
      <TD colspan="2" align="center">
  <br>
        <INPUT type="submit" value="Submit">
        <INPUT type="reset" value="Reset"></TD>
    </TR></TABLE></center></form>';
}
}
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 17, 2009, 04:38:50 AM
I found the problem. Things just weren't put the right place.

I also reformatted the code a bit to make it easier to read and edit in the future.


global $sourcedir, $ID_MEMBER, $context ;

if ($ID_MEMBER == 0)
    echo 'You must be logged in before you can apply.';
else {

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=white>Even if this is nothing like the normal Applications that you are used too, we still expect that every field that requires a written answer to be well written.<p>Please take the time to fill out each field, as this is your first impression to the guild.</p></font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=white>Thanks for applying. Your application has been submitted successfully.<br>We'll review your application and get back to you.<p>Typical response time is 24-48 hours.</p>If you are not contacted by then, please message an officer ingame to discuss your application status.<p>Thank You,<br>Dark Aftermath Recruitment</p></h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
array(
array(
'caption' =>      "Personal Info",
'name' =>         "heading1",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "Name",
'name' =>         "realname",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1   
),
array(
'caption' =>      "Age",
'name' =>         "age",
'type' =>         "select",
'options' =>      "18,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
'defaultvalue' => "18",
'required' =>     1
), 
array(
'caption' =>      "Email",
'name' =>         "charemail",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Member Referral",
'name' =>         "referral",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "Character Info",
'name' =>         "heading1",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "Character Name",
'name' =>         "charname",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1   
),
array(
'caption' =>      "Level",
'name' =>         "charlevel",
'type' =>         "select",
'options' =>      "80,79,78,77,76,75,74,73,72,71",
'defaultvalue' => "80",
'required' =>     1
),
array(
'caption' =>      "Race",
'name' =>         "charrace",
'type' =>         "select",
'options' =>      "Draenei,Dwarf,Gnome,Human,Night Elf",
'defaultvalue' => "Draenei",
'required' =>     1
),
array(
'caption' =>      "Class",
'name' =>         "charclass",
'type' =>         "select",
'options' =>      "Death Knight,Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior",
'defaultvalue' => "Death Knight",
'required' =>     1
),
array(
'caption' =>      "Days played",
'name' =>         "charplayed",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1   
),
array(
'caption' =>      "Profession 1",
'name' =>         "prof1",
'type' =>         "select",
'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
'defaultvalue' => "None",
'required' =>     1
),
array(
'caption' =>      "Profession 2",
'name' =>         "prof2",
'type' =>         "select",
'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
'defaultvalue' => "None",
'required' =>     1
),
array(
'caption' =>      "Primary Spec?",
'name' =>         "primaryspec",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Secondary Spec?",
'name' =>         "secondaryspec",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Armory Link?",
'name' =>         "armory",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Why you speced this way",
'name' =>         "specinfo",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Willing to respec?",
'name' =>         "specstats",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Additional Questions",
'name' =>         "heading1",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "What can you offer<br>Dark Aftermath?",
'name' =>         "offer",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "What are you looking<br>for in Dark Aftermath?",
'name' =>         "looking",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Additional Comments?",
'name' =>         "decision",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Competency Test",
'name' =>         "test",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitment@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
$errors = array(); //Initialize error array
if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
$errors[] = 'You didn' . "'" . 't get the math problem correct';

foreach ($fielddef as $field)
if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
if (isset($errors[0])) {
foreach ($_REQUEST as $key => $value)
$fieldvalue[$key] = $value;
}
else { // all is well
 
$show_form='false';
if ($enable_email) {  // email an application
$subject = 'Recruitment Application';
$body = 'Recruitment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
';
foreach ($fielddef as $field) {
$body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
';
}
mail($email_address, $subject, $body,"From: " . $user_info['email']);
}

if ($enable_post) {  //create new forum post with application

$postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= '[color=white][u][b]' . $field['caption'] . '[/b][/u][/color]<br />';
elseif ($field['type'] == 'textarea') {
$text = $_REQUEST[$field['name']];
$length = 30; // maximum length of a line
$output = '';
while (strlen($text) > $length) {
$textlen = strlen($text);
$part = substr($text,0,$length);
$partlen = $length;
while (substr($part,-1) <> ' ') {
$part = substr($part,0,-1);
--$partlen;
}
$output .= $part . '<br />';
$text = substr($text,$partlen,($textlen-$partlen));
}
$output .= $text;
$postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]<br />' . $output . '<br />';
}
else
$postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
}
$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
createPost($msgOptions, $topicOptions, $posterOptions);
}

// Text for thank you page
echo $thanks_text;
}
}

// Looks like you want the form,
if ($show_form == 'true') {
echo $intro_form . "<br>";
if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
<INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<center><table width="50%">';
$bg = 'windowbg2';
foreach ($fielddef as $field) {
if ($field['type'] == 'text') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
<TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
</TR>';
}
elseif ($field['type'] == 'radio') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD>
<TD align="left">';
$options = explode(',',$field['options']);
foreach ($options as $option) {
echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
echo '>' . $option . ' ';
}
echo '</TD>
</TR>';   
}
elseif ($field['type'] == 'checkbox') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
echo $field['caption'] . ':</TD>
<TD align="left">';
echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '</TD>
</TR>';   
}
elseif ($field['type'] == 'select') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD>
<TD align="left"><SELECT name="' . $field['name'] . '" style="WIDTH: 152px" />';
$options = explode(',',$field['options']);
foreach ($options as $option) {
echo '<OPTION value="' . $option . '"';
if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
echo '>' . $option . '</OPTION>';
}
echo '</SELECT></TD>
</TR>';
}   
elseif ($field['type'] == 'textarea') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD>
<TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
echo $fieldvalue[$field['name']];
echo '</' . 'TEXTAREA></TD>
</TR>';
}
elseif ($field['type'] == 'heading') {
echo '<tr><TD colspan="2">
<center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
<TD style="text-align: center; text-decoration: underline;"><font size="4">' .
$field['caption'] .
'</font></TD></TR></table></center></td></tr>';
}
if ($bg == 'windowbg2') { $bg = 'windowbg'; }
else { $bg = 'windowbg2'; }
}
echo '
<TR class ="' . $bg . '"><td>What is 5 + 7? (enter a number)</td>
<td><input type="text" name="mathtest" value=""></td></tr>';
if ($bg == 'windowbg2') { $bg = 'windowbg'; }
else { $bg = 'windowbg2'; }
echo '
<TR class ="' . $bg . '">
<TD colspan="2" align="center">
<br />
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR></TABLE></center></form>';
}
}
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 17, 2009, 05:54:33 AM
That worked great.  I just have to play with the width of the wrap, but everything else is fantastic.  Thank you so much!!
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on April 18, 2009, 08:09:21 PM
Have 1 other small question.....

On the math question, is there a way for it to post the answer into the forum?  Or post a specific word in the forum like "Passed" or something?

or alternate method...

I have a heading called Competency Test.  On the app they see that.  On the forum it shows it, but there is no answer.  Is it possible to remove the heading in the forum, but keep it in the app similar to how the math question does.

Either way would be fine.  whichever is easier
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 18, 2009, 08:59:42 PM
You can put anything in the forum post that you want. Just add it to the $postbody variable.
Title: Re: [Done!] Join Us! form
Post by: shadrach on April 27, 2009, 06:37:50 PM
Sorry if this is a stupid question, but if I just want to add more questions, do I just make an array, or do I need to add to the code farther on as well?
Title: Re: [Done!] Join Us! form
Post by: JPDeni on April 27, 2009, 06:51:08 PM
You're talking about the code that I wrote -- the most recent one? If so, just add another array.
Title: Re: [Done!] Join Us! form
Post by: Inny on May 04, 2009, 08:59:24 AM
I was thinking if its possible to make the form in 3 steps. Currently its 2, the form and the thanks text.

Will be possible to have the intro text as a separate step?

(Using JPDeni's Form)
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 04, 2009, 02:44:33 PM
Just about anything is possible.


global $sourcedir, $ID_MEMBER, $context, $scripturl;

// Guests can't fill out the form
if ($ID_MEMBER == 0)
    echo 'You must be logged in before you can apply.';
else {
if (!isset($_REQUEST['form'])) {
$intro_form = "Put whatever introduction you want to appear at the top of the form here. You can add html. Be careful with quotation marks.";
$link = '<a href="' . $scripturl . '?page=' . $_REQUEST['page'] . ';form=1">Go to the form</a>';
echo '<div style="text-align:center">' . $intro_form . '<br />' . $link . '</div>';
}
else {
require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$thanks_text = "This is what will appear after the form is submitted. You can use html. Be careful with quotation marks.";

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
array(
array(
'caption' =>      "Heading",
'name' =>         "heading",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "Name",
'name' =>         "realname",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1   
),
array(
'caption' =>      "Age",
'name' =>         "age",
'type' =>         "select",
'options' =>      "13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
'defaultvalue' => "18",
'required' =>     1
), 
array(
'caption' =>      "Sex",
'name' =>         "sex",
'type' =>         "radio",
'options' =>      "M,F",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Do you like me?",
'name' =>         "like",
'type' =>         "checkbox",
'options' =>      "Yes",
'defaultvalue' => "Yes",
'required' =>     0
), 
array(
'caption' =>      "Comments",
'name' =>       "comments",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION
////////////////////////////////////////////////////////////////////////////////////////////


$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
$errors = array(); //Initialize error array

foreach ($fielddef as $field)
if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
if (isset($errors[0])) {
foreach ($_REQUEST as $key => $value)
$fieldvalue[$key] = $value;
}
else { // all is well

$show_form='false';

if ($enable_email) {  // email an application
$subject = 'Recruitment Application';
$body = 'Recruitment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
';
foreach ($fielddef as $field)
$body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
';
mail($email_address, $subject, $body,"From: " . $user_info['email']);
}

if ($enable_post) {  //create new forum post with application

$postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= '[color=red][u][b]' . $field['caption'] . '[/b][/u][/color]  ' . $_REQUEST[$field['name']] . '<br />';
else
$postbody .= '[color=green]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
}

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
createPost($msgOptions, $topicOptions, $posterOptions);
}
// Text for thank you page
echo $thanks_text;
}
}

// Looks like you want the form,
if ($show_form == 'true') {
echo $intro_form . "<br>";
if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }

echo '
<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
<INPUT name="submitted" type="hidden" value="TRUE" />
<INPUT name="form" type="hidden" value="1" />
        <table style="margin-left:auto; margin-right:auto;">';

$bg = 'windowbg2';

foreach ($fielddef as $field) {
// Headings have their own type of display
if ($field['type'] == 'heading') {
echo '
<TR>
<TD colspan="2" style="text-align: center; text-decoration: underline;">' .
$field['caption'] . '
</TD>
</TR>';
}

else {

// How each field is displayed in the table
echo '
<TR class ="' . $bg . '">
<TD align="right">';
      if ($field['required'] == 1) { echo '* '; }
  echo $field['caption'] . ':
</TD>
<TD align="left">';

// Go through each field type
if ($field['type'] == 'text') {
echo '<INPUT name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" />';
}
elseif ($field['type'] == 'radio') {
$options = explode(',',$field['options']);
foreach ($options as $option) {
echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
echo '>' . $option . ' ';
}
}
elseif ($field['type'] == 'checkbox') {
echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
echo '>' . $field['options'];   
}
elseif ($field['type'] == 'select') {
echo '<SELECT name="' . $field['name'] . '" />';
$options = explode(',',$field['options']);
foreach ($options as $option) {
echo '<OPTION value="' . $option . '"';
if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
echo '>' . $option . '</OPTION>';
}
echo '</SELECT>';
}   
elseif ($field['type'] == 'textarea') {
echo '<TEXTAREA name="' . $field['name'] . '" rows="4" cols="40">';
echo $fieldvalue[$field['name']];
echo '</' . 'TEXTAREA>';
}

// Finish off the row
echo '
</TD>
</TR>';
}

// Set up the alternating colors for the next row
($bg == 'windowbg2') ? $bg = 'windowbg' : $bg = 'windowbg2';
}

echo '
<TR class ="' . $bg . '">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset">
</TD>
</TR>
</TABLE>
</form>';
}
}
}
Title: Re: [Done!] Join Us! form
Post by: Inny on May 04, 2009, 03:46:53 PM
Thanks  ;)

Getting error on Line 7: Parse error: syntax error, unexpected '{'

Also which part should i remove so guests are able to fill a form.
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 04, 2009, 05:08:40 PM
I fixed the error. Those nasty parentheses.

QuoteAlso which part should i remove so guests are able to fill a form.

:)

Delete


if ($ID_MEMBER == 0)
    echo 'You must be logged in before you can apply.';
else {


and the very last


}

Title: Re: [Done!] Join Us! form
Post by: Inny on May 04, 2009, 05:29:37 PM
Parse error: syntax error, unexpected '/' on line 243  ???
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 04, 2009, 05:58:36 PM
Try it now.
Title: Re: [Done!] Join Us! form
Post by: Inny on May 04, 2009, 07:16:48 PM
Thanks Working now  :up:
Title: Re: [Done!] Join Us! form
Post by: Razzik on May 15, 2009, 04:47:12 PM
When someone includes a link (armory link etc.) in the application form, it creates post on forum but upon opening the post it gives this error
Database Error: MySQL server has gone away
File: /home/a7981124/public_html/Sources/Subs.php
Line: 703


I tried it without links and everything was fine.

Can anyone help me?

Thanks in advance
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 15, 2009, 06:00:46 PM
What code are you using? There are 39 pages in this topic with lots and lots of variations on the code. Also, can you look into your database via something like phpMyAdmin and see what the post looks like?
Title: Re: [Done!] Join Us! form
Post by: Razzik on May 15, 2009, 06:13:52 PM
Ok I fixed it, thanks anyway.
Somehow when I removed the text-decoration: underline; it wouldnt work.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 22, 2009, 10:40:11 AM
Hello, its me again!   ;D

Was wondering if you could help me clean this application up.  It is working, but I have tried a few times to alter the looks of it to no avail. 

Here are some screenshots...

Recruitment Form
http://screenshots.darkaftermath.com/recruitmentform.jpg

Recruitment Post
http://screenshots.darkaftermath.com/recruitmentformpost.jpg

Here is the code I am using...

global $sourcedir, $ID_MEMBER, $context ;

if ($ID_MEMBER == 0)
    echo 'You must be logged in before you can apply.';
else {

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');


// CONFIGURATION SECTION

$intro_form = "<center><h4><font color=white>Even if this is nothing like the normal Applications that you are used too, we still expect that every field that requires a written answer to be well written.<p>Please take the time to fill out each field, as this is your first impression to the guild.</p></font></h4> </center><br>";   // Can include html

$thanks_text = "<center><h3><font color=white>Thanks for applying. Your application has been submitted successfully.<br>We'll review your application and get back to you.<p>Typical response time is 24-48 hours.</p>If you are not contacted by then, please message an officer in-game to discuss your application status.<p>Thank You,<br>Dark Aftermath Recruitment</p></h3></font></center>"; // what is displayed after the form is submitted

// Define your fields. All of these values need to be defined, even if they are empty.
// The fields will be displayed in the order in which they are listed in the array.
// $fielddef =
//   array(
//     array(
//       'caption' =>      "", // caption to be displayed on the form. Can include symbols and spaces.
//       'name' =>         "", // a unique name for the field. No symbols or spaces
//       'type' =>         "", // text, radio, select, checkbox, textarea, heading
//       'options' =>      "", // for radio and select fields. List in order you wish them to appear, separated by commas; for checkboxes, it's the value to be saved and displayed next to the box
//       'defaultvalue' => "", // the default value for the field. Can be a variable or text. Be sure to enclose text in quotation marks
//       'required' =>     0   // 0 or 1 -- use 1 if the field must be filled out. use 0 if it's optional; never set a checkbox to be required
//     ),
//   );

$fielddef =
array(
array(
'caption' =>      "Personal Info",
'name' =>         "heading1",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "Name",
'name' =>         "realname",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1  
),
array(
'caption' =>      "Age",
'name' =>         "age",
'type' =>         "select",
'options' =>      "18,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40+",
'defaultvalue' => "18",
'required' =>     1
), 
array(
'caption' =>      "Email",
'name' =>         "charemail",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Member Referral",
'name' =>         "referral",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "Character Info",
'name' =>         "heading1",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "Character Name",
'name' =>         "charname",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1  
),
array(
'caption' =>      "Level",
'name' =>         "charlevel",
'type' =>         "select",
'options' =>      "80,79,78,77,76,75,74,73,72,71",
'defaultvalue' => "80",
'required' =>     1
),
array(
'caption' =>      "Race",
'name' =>         "charrace",
'type' =>         "select",
'options' =>      "Draenei,Dwarf,Gnome,Human,Night Elf",
'defaultvalue' => "Draenei",
'required' =>     1
),
array(
'caption' =>      "Class",
'name' =>         "charclass",
'type' =>         "select",
'options' =>      "Death Knight,Druid,Hunter,Mage,Paladin,Priest,Rogue,Shaman,Warlock,Warrior",
'defaultvalue' => "Death Knight",
'required' =>     1
),
array(
'caption' =>      "Days played",
'name' =>         "charplayed",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1  
),
array(
'caption' =>      "Profession 1",
'name' =>         "prof1",
'type' =>         "select",
'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
'defaultvalue' => "None",
'required' =>     1
),
array(
'caption' =>      "Profession 2",
'name' =>         "prof2",
'type' =>         "select",
'options' =>      "None,Herbalism,Mining,Skinning,Alchemy,Blacksmithing,Enchanting,Engineering,Leatherworking,Tailoring,Jewelcrafting,Inscription",
'defaultvalue' => "None",
'required' =>     1
),
array(
'caption' =>      "Primary Spec?",
'name' =>         "primaryspec",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Secondary Spec?",
'name' =>         "secondaryspec",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Armory Link?",
'name' =>         "armory",
'type' =>         "text",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Why you speced this way",
'name' =>         "specinfo",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Willing to respec?",
'name' =>         "specstats",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Additional Questions",
'name' =>         "heading1",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
array(
'caption' =>      "What can you offer<br>Dark Aftermath?",
'name' =>         "offer",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "What are you looking for in<br>Dark Aftermath?",
'name' =>         "looking",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Additional Comments?",
'name' =>         "decision",
'type' =>         "textarea",
'options' =>      "",
'defaultvalue' => "",
'required' =>     1
),
array(
'caption' =>      "Competency Test",
'name' =>         "test",
'type' =>         "heading",
'options' =>      "",
'defaultvalue' => "",
'required' =>     0
),
);



//send the application by email?
$enable_email=false;

// email address of recruitment staff member
$email_address='recruitment@darkaftermath.org';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=4;


//END OF CONFIGURATION SECTION



$show_form= 'true';
if (isset($_REQUEST['submitted'])) {  // Handle the form
// Check required fields
$errors = array(); //Initialize error array
if (!isset($_REQUEST['mathtest']) or ($_REQUEST['mathtest'] <> 12))
$errors[] = 'You didn' . "'" . 't get the math problem correct';

foreach ($fielddef as $field)
if (empty($_REQUEST[$field['name']]) && ($field['required'] == 1)){ $errors[] = $field['name']; }

// There's at least one field missing
if (isset($errors[0])) {
foreach ($_REQUEST as $key => $value)
$fieldvalue[$key] = $value;
}
else { // all is well
 
$show_form='false';
if ($enable_email) {  // email an application
$subject = 'Recruitment Application';
$body = 'Recruitment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
';
foreach ($fielddef as $field) {
$body .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '
';
}
mail($email_address, $subject, $body,"From: " . $user_info['email']);
}

if ($enable_post) {  //create new forum post with application

$postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= '[color=white][u][b]' . $field['caption'] . '[/b][/u][/color]<br />';
elseif ($field['type'] == 'textarea') {
$text = $_REQUEST[$field['name']];
$length = 150; // maximum length of a line
$output = '';
while (strlen($text) > $length) {
$textlen = strlen($text);
$part = substr($text,0,$length);
$partlen = $length;
while (substr($part,-1) <> ' ') {
$part = substr($part,0,-1);
--$partlen;
}
$output .= $part . '<br />';
$text = substr($text,$partlen,($textlen-$partlen));
}
$output .= $text;
$postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]<br />' . $output . '<br />';
}
else
$postbody .= '[color=#5BAFDF]' . $field['caption'] . '[/color]  ' . $_REQUEST[$field['name']] . '<br />';
}
$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $_REQUEST['charname'] . ' ' . $_REQUEST['charclass'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
createPost($msgOptions, $topicOptions, $posterOptions);
}

// Text for thank you page
echo $thanks_text;
}
}

// Looks like you want the form,
if ($show_form == 'true') {
echo $intro_form . "<br>";
if (isset($errors[0])) { echo '<div style="color: red;">Please fill in all fields with a *.</div>';  }
echo '<form action="' . $scripturl . '?page='  . $_GET['page'] . '" method="post">
<INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<center><table width="50%">';
$bg = 'windowbg2';
foreach ($fielddef as $field) {
if ($field['type'] == 'text') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
<TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" /></TD>
</TR>';
}
elseif ($field['type'] == 'radio') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD>
<TD align="left">';
$options = explode(',',$field['options']);
foreach ($options as $option) {
echo '<INPUT TYPE="RADIO" NAME="' . $field['name'] . '" VALUE="'. $option . '"';
if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' CHECKED'; }
echo '>' . $option . ' ';
}
echo '</TD>
</TR>';  
}
elseif ($field['type'] == 'checkbox') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
echo $field['caption'] . ':</TD>
<TD align="left">';
echo '<INPUT TYPE="CHECKBOX" NAME="' . $field['name'] . '" VALUE="'. $field['options'] . '"';
                if (isset($fieldvalue[$field['name']]) && ($fieldvalue[$field['name']]==$field['options'])) { echo ' CHECKED'; }
                echo '>' . $field['options'] . '</TD>
</TR>';  
}
elseif ($field['type'] == 'select') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD>
<TD align="left"><SELECT name="' . $field['name'] . '" style="WIDTH: 152px" />';
$options = explode(',',$field['options']);
foreach ($options as $option) {
echo '<OPTION value="' . $option . '"';
if ((isset($fieldvalue[$field['name']])) && ($option == $fieldvalue[$field['name']])) { echo ' selected'; }
echo '>' . $option . '</OPTION>';
}
echo '</SELECT></TD>
</TR>';
}   
elseif ($field['type'] == 'textarea') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD>
<TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
echo $fieldvalue[$field['name']];
echo '</' . 'TEXTAREA></TD>
</TR>';
}
elseif ($field['type'] == 'heading') {
echo '<tr><TD colspan="2">
<center><table cellSpacing="1" cellPadding="1" width="50%"><TR>
<TD style="text-align: center; text-decoration: underline;"><font size="4">' .
$field['caption'] .
'</font></TD></TR></table></center></td></tr>';
}
if ($bg == 'windowbg2') { $bg = 'windowbg'; }
else { $bg = 'windowbg2'; }
}
echo '
<TR class ="' . $bg . '"><td>What is 5 + 7? (enter a number)</td>
<td><input type="text" name="mathtest" value=""></td></tr>';
if ($bg == 'windowbg2') { $bg = 'windowbg'; }
else { $bg = 'windowbg2'; }
echo '
<TR class ="' . $bg . '">
<TD colspan="2" align="center">
<br />
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR></TABLE></center></form>';
}
}


Everytime I try I either get a parse error, or it doesnt look proper.  I just want the application to look nice. 
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 22, 2009, 01:21:57 PM
Overall -- if you want to have different structures for different fields of the same type, you'll need to use different code. For example, if you want a textarea to have the label to the side on one field and on top on another field, you can't use this code. Or, if you want one text field to be longer than the others, you'll need to use other code.

If you want to extend the length of the text fields, you can do that. Find the section that prints out text fields and put in a size tag.


if ($field['type'] == 'text') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
              if ($field['required'] == 1) { echo '* '; }
              echo $field['caption'] . ':</TD>
<TD align="left"><INPUT id="' . $field['name'] . '" name="' . $field['name'] . '" type="text" value ="' . $fieldvalue[$field['name']] . '" size="40"/></TD>
</TR>';
}


See where I put size="40"? Adjust that number until it's what you want.

I'm not sure what you mean by
QuoteCan "Willing to respec" box be changed to a short box
If you want a one-line text field instead of a textarea, just set it in the field definition.

Change

'caption' =>      "Willing to respec?",
'name' =>         "specstats",
'type' =>         "textarea",


to


'caption' =>      "Willing to respec?",
'name' =>         "specstats",
'type' =>         "text",


As for moving the field, just move the field definition. The fields are displayed in the same order that you define them.

You ask
QuoteCan this box be removed?
Of course. Just delete it from the field definition.

If you want the labels for textareas to be above the field instead of to the side, change

elseif ($field['type'] == 'textarea') {
echo '<TR class ="' . $bg . '">
<TD width = "200px" align="right">';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD>
<TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
echo $fieldvalue[$field['name']];
echo '</' . 'TEXTAREA></TD>
</TR>';
}


to


elseif ($field['type'] == 'textarea') {
echo '<TR class ="' . $bg . '">
<TD> </td><td>';
if ($field['required'] == 1) { echo '* '; }
echo $field['caption'] . ':</TD></tr>
<tr><td> </td><TD align="left"><TEXTAREA id="' . $field['name'] . '" name="' . $field['name'] . '" rows="4" cols="40">';
echo $fieldvalue[$field['name']];
echo '</' . 'TEXTAREA></TD>
</TR>';
}


As for the display, it seems that everything is okay, except that you say
QuoteI was wondering if we could have it say Passed?

You can have it say Rumplestiltskin if you want. ;)

I'm assuming that you only want it to say PASSED if they get the "mathest" right.

Before

$msgOptions = array(


Add


if (isset($_REQUEST['mathest']) && $_REQUEST['mathest'] == 12)
    $postbody .= 'PASSED';
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 22, 2009, 02:27:26 PM
This is fantastic.  I will get on this and let you know what I end up with.

Thank you!!    ;D
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 22, 2009, 03:21:20 PM
Well I got alot of it changed over.

Are you sure the code you posted is the same as mine?  I did a search for "Overall" and I do not even have that word in my code.

Anyway, all that is left are 2 things.

The only "text" box that I want larger was the armory link.  It is a web address so wanted that box only larger.   Unless there is a way with it preformatting to http:// in the box already!!!   ;D

Also the "Passed" option did nothing.  I put it directly above like you said.  No parse error, but no output either.  I thought you might of missed a } but that gave me a parse error...  >:D
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 22, 2009, 03:35:52 PM
QuoteAre you sure the code you posted is the same as mine?  I did a search for "Overall" and I do not even have that word in my code.

That's because there was an error in my post. The sentence that starts with "Overall" was a comment. Please read my post again.

QuoteThe only "text" box that I want larger was the armory link.

You'll need to use different code, then. This code creates fields of the same size.

QuoteUnless there is a way with it preformatting to http:// in the box already!!!

There's a "default" value for each field. If you want the filled prefilled with http://, put that in the default value for the field.

QuoteAlso the "Passed" option did nothing.
Try

if (isset($_REQUEST['mathest']) && $_REQUEST['mathest'] == '12')
    $postbody .= 'PASSED';


Make sure that you have entered the right number in the field. It's supposed to just print the word if they get it right.

The reason that a } isn't necessary is that there's only one line after the "if" statement. You could also use


if (isset($_REQUEST['mathest']) && $_REQUEST['mathest'] == '12') {
    $postbody .= 'PASSED';
}

if you wanted, but it's optional.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 22, 2009, 05:34:01 PM
Ok I will stick with this code.

But the http:// code I used is this

array(
'caption' =>      "Armory Link?",
'name' =>         "armory",
'type' =>         "text",
'options' =>      "http://",
'defaultvalue' => "http://",
'required' =>     1
),


Tried with and without the 'options' filled in.  It doesnt add the http://
I also refreshed my cache as sometimes that worked.  It didnt.

As far as the mathtest.  If they get the code wrong or blank it doesnt post anything.  So I entered the new code.....

                        if (isset($_REQUEST['mathest']) && $_REQUEST['mathest'] == '12') {
    $postbody .= 'PASSED';
                        }                                       
$msgOptions = array(


And still nothing in the forum.  I do get the header but not the PASSED.

edit:  fixed the 'mathtest' typo.  still nothing
edit again:  fixed both 'mathtest' typos....now it works! 
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 22, 2009, 06:26:02 PM
Good for you catching the typos. Just one of those things. :)

The default value should work, although I've never tried it with http://.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 23, 2009, 10:18:29 AM
Ok last question.

http://forum.darkaftermath.com/index.php?page=6

How do I get the text for the test aligned to the right like the rest of the form?  It looks to be aligned left, but I do not see where to add the code.


Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 23, 2009, 01:09:18 PM
If you look at the other fields, you'll see that the table cell for the caption starts with


<TD width = "200px" align="right">


Every one of them is the same.

Then look at the "math test".


<td>


Make the "mathtest" table cell look the same as the other table cells. :)
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 23, 2009, 07:51:16 PM
Perfect, thank you.

Now time to take all the new tools and see which way I like best  :2funny:
Title: Re: [Done!] Join Us! form
Post by: ZarPrime on May 23, 2009, 09:28:43 PM
JPDeni,

I think I'd like to try this code but I'm not sure which code snippet to use because there have been so many changes.

Do you think maybe you could possibly post the latest code here, and then I will go in and link the best and latest code in the OP of the topic with an explanation as to exactly what all it does.  That way, it will be easier for someone else who wants to use the latest and greatest code.

Thanks,
ZarPrime
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 23, 2009, 10:47:32 PM
I could link my code if you like.

With a link and/or screenshot to the output.
Title: Re: [Done!] Join Us! form
Post by: ZarPrime on May 23, 2009, 10:50:42 PM
Quote from: Azphat12 on May 23, 2009, 10:47:32 PM
I could link my code if you like.

With a link and/or screenshot to the output.

Azphat12,

Sure, that would be great, and then I will modify the first post to point to the code you post as the latest code for the snippet.

ZarPrime
Title: Re: [Done!] Join Us! form
Post by: JPDeni on May 23, 2009, 11:01:20 PM
Actually, I think it would be better for us to shut this topic down and start a new one with my code, rather than posting my code in someone else's post.

Edited to add: My code is here --> http://www.tinyportal.net/index.php/topic,29670
Title: Re: [Done!] Join Us! form
Post by: ZarPrime on May 24, 2009, 12:04:22 AM
JPD,

I think you're right.  This topic has become so convoluted it's difficult to figure out which code to use.

ZarPrime
Title: Re: [Done!] Join Us! form
Post by: IchBin on May 24, 2009, 12:41:13 AM
Posted a link in the first post for updated code by Deni.
Title: Re: [Done!] Join Us! form
Post by: Azphat12 on May 24, 2009, 02:37:14 AM
I will leave it as is then.  If anyone would like to use mine, I would be happy to post/send it to them. 

Title: Re: [Done!] Join Us! form
Post by: Anthea on August 06, 2009, 10:29:48 PM
Hi guys!

I reformatted the applicaiton form to suit my online gaming guild. ( thanks for the application btw) however I think I messed something up and it is not working. I would appreciate any help any of you could give me, as to what I did wrong.

Thanks ahead of time.

if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registered on the site in order to apply for Guild Membership.';
} else  {

global $sourcedir, $user_info, $context ;

require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');



// CONFIGURATION SECTION

//send the application by email?
$enable_email=false;

// email address of recruitment officer
$email_address='pirateprincess@piratelords.com';

//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=8 ;

//the id of the this article
$this_article_id = '85';

//article to be redirected when form is submitted
$thank_you_article_id = '86';


//END OF CONFIGURATION SECTION

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter your name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your email address.';
}       
// Check for an age
if (empty($_POST['age']) ){
$enroll_errors[] = 'You forgot to enter your age.';
}     
// Check for gender
if (empty($_POST['gender']) ){
$enroll_errors[] = 'You forgot to enter your gender.';
}       
    // Check for time zone
if (empty($_POST['time_zone']) ){
$enroll_errors[] = 'You forgot to enter your time zone.';
}       
// Check for level
if (empty($_POST['level']) ){
$enroll_errors[] = 'You forgot to enter your level.';
}
    // Check for class
if (empty($_POST['class']) ){
$enroll_errors[] = 'You forgot to enter your class.';
}
    // Check for previous guilds
if (empty($_POST['prev_kins']) ){
$enroll_errors[] = 'You forgot to enter your previous guilds.';
}

if (empty($enroll_errors)) { //Everything seems to be OK
     
        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Characters Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Time Zone: ' . $_POST['time_zone'] . '
Current Level:  ' . $_POST['level'] . '
Class:  ' . $_POST['class'] . '
Previous Guild(s):  ' . $_POST['prev_guild'] . '
Do you have raiding experience: ' . $_POST['raid'] . '
Describe that experience:  ' . $_POST['raid_exp'] . '
Do you have PvP experience: ' . $_POST['pvp'] . '
Describe that experience:  ' . $_POST['pvp_exp'] . '
What Rank are you: ' . $_POST['rank'] . '
Do you have/plan on any Crafting Professions:  ' . $_POST['profs'] . '
Which Professions:  ' . $_POST['skills'] . '
Ventrilo installed:  ' . $_POST['vent'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Have you read our Guild Rules?: ' . $_POST['read'] . '
Why do you want to join our Guild?:  ' . $_POST['why'] . '
Do you know anyone in PirateLords?:   ' . $_POST['know'] . '
Who do you know in PirateLords?:   ' . $_POST['know_who'] . '
Other information:  ' . $_POST['other'];
Question 1:  ' . $_POST['q1'];
Question 2:  ' . $_POST['q2'];
Question 3:  ' . $_POST['q3'];
Question 4:  ' . $_POST['q4'];
Question 5:  ' . $_POST['q5'];
Question 6:  ' . $_POST['q6'];
Question 7:  ' . $_POST['q7'];
Question 8:  ' . $_POST['q8'];

$postbody = 'Enrollment application has been made by ' . $context['user']['real_name'] .'
[table]
[tr][td]Characters Name:[/td][td] ' . $_POST['real_name'] . '[/td][/tr]
[tr][td]Email address:[/td][td] ' . $_POST['email'] . '[/td][/tr]
[tr][td]Age:[/td][td] ' . $_POST['age'] . '[/td][/tr]
[tr][td]Gender:[/td][td] ' . $_POST['gender'] . '[/td][/tr]
[tr][td]Time Zone: ' . $_POST['time_zone'] . '[/td][/tr]
[tr][td]Current Level:[/td][td] ' . $_POST['level'] . '[/td][/tr]
[tr][td]Class:[/td][td] ' . $_POST['class'] . '[/td][/tr]
[tr][td]Previous Guild(s):[/td][td] ' . $_POST['prev_guild'] . '[/td][/tr]
[tr][td]Do you have raiding experience:[/td][td] ' . $_POST['raid'] . '[/td][/tr]
[tr][td]Describe that experience:[/td][td] ' . $_POST['raid_exp'] . '[/td][/tr]
[tr][td]Do you have PvP experience: ' . $_POST['pvp'] . '[/td][/tr]
[tr][td]Describe that experience:[/td][td] ' . $_POST['pvp_exp'] . '[/td][/tr]
[tr][td]What Rank are you: ' . $_POST['rank'] . '[/td][/tr]
[tr][td]Do you have any Crafting Professions[/td][td] ' . $_POST['profs'] . '[/td][/tr]
[tr][td]Which Professions:[/td][td] ' . $_POST['skills'] . '[/td][/tr]
[tr][td]Ventrilo installed?:[/td][td] ' . $_POST['vent'] . '[/td][/tr]
[tr][td]Have microphone/headset:[/td][td] ' . $_POST['mic'] . '[/td][/tr]
[tr][td]Have you read our Guild Rules?:[/td][td] ' . $_POST['read'] . '[/td][/tr]
[tr][td]Why do you want to join PirateLords?:[/td][td] ' . $_POST['why'] . '[/td][/tr]
[tr][td]Do you know anyone in PirateLords?:[/td][td] ' . $_POST['know'] . '[/td][/tr]
[tr][td]Who do you know in PirateLords?:[/td][td] ' . $_POST['know_who'] . '[/td][/tr]
[tr][td]Other game information:[/td][td] ' . $_POST['other']. '[/td][/tr]
[tr][td]Question 1:[/td][td] ' . $_POST['q1']. '[/td][/tr]
[tr][td]Question 2:[/td][td] ' . $_POST['q2']. '[/td][/tr]
[tr][td]Question 3:[/td][td] ' . $_POST['q3']. '[/td][/tr]
[tr][td]Question 4:[/td][td] ' . $_POST['q4']. '[/td][/tr]
[tr][td]Question 5:[/td][td] ' . $_POST['q5']. '[/td][/tr]
[tr][td]Question 6:[/td][td] ' . $_POST['q6']. '[/td][/tr]
[tr][td]Question 7:[/td][td] ' . $_POST['q7']. '[/td][/tr]
[tr][td]Question 8:[/td][td] ' . $_POST['q8']. '[/td][/tr]
[/table]';



            if ($enable_email)
mail($email_address, $subject, $body,"From: " . $_POST['email']);



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Pending] Application of ' . $_POST['real_name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);
   
if ($enable_post)
            createPost($msgOptions, $topicOptions, $posterOptions);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/deck/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/deck/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<br />
<br />
<center>
<font size="3"><strong>Welcome to the PirateLords Application.</strong> <br />
Please fill out all the information. Incomplete Applications will be denied. If there is information that does not pertain to you please just use N/A.<br />
If you have any concerns, please feel free to email us <a href="mailto:pirateprincess@piratelords.com">here</a>.<br />
<br />
<br />
</font>
</center>


<form action="index.php?page='  . $this_article_id  . '" method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
            <TR class ="windowbg">
<TD colspan="2" align="center"> <p>&nbsp;</p>
  <p>Section 1 </p>
    <p>&nbsp;</p></TD>
</TR>
<TR class ="windowbg">
<TD width = "25%">* Characters Name:</TD>
<TD><input id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "25%">* Email address:</TD>
<TD><INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "25%">* Age:</TD>
<TD><SELECT id="age" name="age" style="WIDTH: 160px" value ="';
if (isset($_POST['age'])) echo $_POST['age'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="18+">Over 18</OPTION>
<OPTION value="18-">Under 18</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "25%">*Gender:
  </TD>
<TD><SELECT id = "gender" name = "gender" style="WIDTH: 160px" value ="';
if (isset($_POST['gender'])) echo $_POST['gender'];   
echo '" />
<OPTION value="No Answer" selected>--------------------------</OPTION>
<OPTION value="M">Male</OPTION>
<OPTION value="F">Female</OPTION>
</SELECT></TD>
                    </TR>
<TR class ="windowbg">
<TD width = "25%">*Time Zone:</TD>
<TD><INPUT id="time_zone" name="time_zone" type="text" value ="';
if (isset($_POST['time_zone'])) echo $_POST['time_zone'];   
echo '" /></TD>
</TR>
</TR>
<TR class ="windowbg">
<TD width = "25%">*Current Level:</TD>
<TD><INPUT id="level" name="level" type="text" value ="';
if (isset($_POST['level'])) echo $_POST['level'];   
echo '" /></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">*Class:</TD>
<TD><INPUT id ="class" name ="class" rows="4" cols="40"  value ="';
if (isset($_POST['class'])) echo $_POST['class'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg">
<TD width = "25%">Previous Guild(s):</TD>
<TD><TEXTAREA id="prev_kins" name="prev_kins" type="text" rows="4" cols="40" value ="';
if (isset($_POST['prev_kins'])) echo $_POST['prev_kins']; 
echo '" /></' . 'TEXTAREA></TD>
            </TR>
</TR>
<TR class ="windowbg2">
<TD width = "25%">Do you have raiding experience?:</TD>
<TD><SELECT id="raid" name="raid" style="WIDTH: 160px" value ="';
if (isset($_POST['raid'])) echo $_POST['raid'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "25%">If so, describe that experience:</TD>
<TD><TEXTAREA id="raid_exp" name="raid_exp" type="text" rows="4" cols="40" value ="';
if (isset($_POST['raid_exp'])) echo $_POST['raid_exp']; 
echo '" /></' . 'TEXTAREA></TD>
            </TR>
            <TR class ="windowbg2">
<TD width = "25%">Do you have PvP experience?:</TD>
<TD><SELECT id="pvp" name="pvp" style="WIDTH: 160px" value ="';
if (isset($_POST['pvp'])) echo $_POST['pvp'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
            <TR class ="windowbg">
<TD width = "25%">If so, describe that experience:</TD>
<TD><TEXTAREA id="pvp_exp" name="pvp_exp" type="text" rows="4" cols="40" value ="';
if (isset($_POST['pvp_exp'])) echo $_POST['pvp_exp']; 
echo '" /></' . 'TEXTAREA></TD>
            </TR>
            <TR class ="windowbg">
            <TD width = "25%">What Rank are you in Aion?:</TD>
<TD><SELECT id="rank" name="rank" style="WIDTH: 160px" value ="';
if (isset($_POST['rank'])) echo $_POST['rank']; 
echo '" />
                        <OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="1">Rank 9</OPTION>
<OPTION value="2">Rank 8</OPTION>
                        <OPTION value="3">Rank 7</OPTION>
<OPTION value="4">Rank 6</OPTION>
                        <OPTION value="5">Rank 5</OPTION>
<OPTION value="6">Rank 4</OPTION>
                        <OPTION value="7">Rank 3</OPTION>
<OPTION value="8">Rank 2</OPTION>
                        <OPTION value="9">Rank 1</OPTION>
<OPTION value="10">Asmodian Army 1-Star Officer</OPTION>
                        <OPTION value="11">Asmodian Army 2-Star Officer</OPTION>
<OPTION value="12">Asmodian Army 3-Star Officer</OPTION>
                        <OPTION value="13">Asmodian Army 4-Star Officer</OPTION>
<OPTION value="14">Asmodian Army 5-Star Officer</OPTION>
                        <OPTION value="15">Asmodian Army General</OPTION>
                        <OPTION value="16">Asmodian Army Great General</OPTION>
                        <OPTION value="17">Asmodian Army Commander</OPTION>
                        <OPTION value="18">Asmodian Army Commander-in-Chief</OPTION>
</SELECT></TD>
            </TR>
<TR class ="windowbg2">
<TD width = "25%">Do you have/plan on any Crafting Professions? :</TD>
<TD><SELECT id="profs" name="profs" style="WIDTH: 160px" value ="';
if (isset($_POST['profs'])) echo $_POST['profs'];
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "25%">Which Crafting Professions? (include level):</TD>
<TD><TEXTAREA id="skills" name="skills" type="text" rows="4" cols="40" value ="';
if (isset($_POST['skills'])) echo $_POST['skills'];   
echo '" /></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "25%">Do you have Ventrilo installed?:</TD>
<TD><SELECT id="vent" name="vent" style="WIDTH: 160px" value ="';
if (isset($_POST['vent'])) echo $_POST['vent'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "25%">Do you have microphone/headset?:</TD>
<TD><SELECT id="mic" name="mic" style="WIDTH: 160px" value ="';
if (isset($_POST['mic'])) echo $_POST['mic'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg2">
<TD width = "25%">Have you read our Guild Rules?:</TD>
<TD><SELECT id="read" name="read" style="WIDTH: 160px" value ="';
if (isset($_POST['read'])) echo $_POST['read'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="Yes">Yes</OPTION>
<OPTION value="No">No</OPTION>
<OPTION value="The what?">The what?</OPTION>
</SELECT></TD>
</TR>
<TR class ="windowbg">
<TD width = "25%">Why do you want to join PirateLords?:</TD>
<TD><TEXTAREA id="why" name="why" type="text" rows="4" cols="40" value ="';
if (isset($_POST['why'])) echo $_POST['why']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD width = "25%">Do you know anyone in PirateLords?:</TD>
<TD><SELECT id="know" name="know" style="WIDTH: 160px" value ="';
if (isset($_POST['know'])) echo $_POST['know'];   
echo '" />
<OPTION value="No answer" selected>--------------------------</OPTION>
<OPTION value="YES">Yes</OPTION>
<OPTION value="NO">No</OPTION>
</SELECT></TD>
</TR>
            <TR class ="windowbg">
<TD width = "25%">Who do you know in PirateLords?:</TD>
<TD><TEXTAREA id="know_who" name="know_who" type="text" rows="4" cols="40" value ="';
if (isset($_POST['know_who'])) echo $_POST['know_who']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">Any other gaming information you wish to share with us?:</TD>
<TD><TEXTAREA id="other" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg">
<TD colspan="2" align="center"> <p>&nbsp;</p>
  <p>Section 2 </p>
    <p>&nbsp;</p></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">What are you looking for in a guild and why?:</TD>
<TD><TEXTAREA id="q1" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q1'])) echo $_POST['q1']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">Explain to us how you percieve your character's role in a guild and why:</TD>
<TD><TEXTAREA id="q2" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q2'])) echo $_POST['q2']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">Please describe to us your playstyle (healer, tank, etc ) and why you chose this style:</TD>
<TD><TEXTAREA id="q3" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q3'])) echo $_POST['q3']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">If you have been a member of any other guilds, please give us your reasons for leaving:</TD>
<TD><TEXTAREA id="q4" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q41'])) echo $_POST['q4']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">What aspects of Aion interest you and why?:</TD>
<TD><TEXTAREA id="q5" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q5'])) echo $_POST['q5']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg2">
<TD width = "25%">Are you dedicated to your guild by helping other members, and participating in guild activities:</TD>
<TD><TEXTAREA id="q6" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q6'])) echo $_POST['q6']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
                <TR class ="windowbg2">
<TD width = "25%">Please share some information about yourself that will help us make a decision:</TD>
<TD><TEXTAREA id="q7" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q7'])) echo $_POST['q7']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
                <TR class ="windowbg2">
<TD width = "25%">Tell us something funny about yourself, or share a funny story that you experienced:</TD>
<TD><TEXTAREA id="q8" name="other" type="text" rows="4" cols="40" value ="';
if (isset($_POST['q8'])) echo $_POST['q8']; 
echo '" /></' . 'TEXTAREA></TD>
</TR>
            <TR class ="windowbg">
<TD colspan="2" align="center"> <p>&nbsp;</p>
  <p>PirateLords reserves the right to withhold any information pertaining to the applications. By submitting this application for review, the applicant attests that all information provided in this application is true and without falsification, and is a serious applicant to the PirateLords.</p>
    <p>&nbsp;</p></TD>
</TR>
<TR class ="windowbg">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TR>
</TABLE>
</form>

';
}

Title: Re: [Done!] Join Us! form
Post by: JPDeni on August 06, 2009, 10:38:51 PM
How is it "not working"? If you give a little more information, it'll give us some idea of what to look for. Specifically, if you get an error message with a line number, that'll narrow things down a whole lot.
Title: Re: [Done!] Join Us! form
Post by: Anthea on August 13, 2009, 06:52:28 PM
When you go to the Article it comes up completely blank - as if nothing were in the article at all.

:-\
Title: Re: [Done!] Join Us! form
Post by: JPDeni on August 13, 2009, 06:56:40 PM
You'll need to give me a link so I can see what's going on. Or you can use the Generic Application Form code which I know a whole lot more about.
Title: Re: [Done!] Join Us! form
Post by: Hairy on August 30, 2009, 02:16:58 PM
Hi Laluna, I found 2 problem areas in your code.

Find

Other information:  ' . $_POST['other'];
Question 1:  ' . $_POST['q1'];
Question 2:  ' . $_POST['q2'];
Question 3:  ' . $_POST['q3'];
Question 4:  ' . $_POST['q4'];
Question 5:  ' . $_POST['q5'];
Question 6:  ' . $_POST['q6'];
Question 7:  ' . $_POST['q7'];
Question 8:  ' . $_POST['q8'];


Replace with

Other information:  ' . $_POST['other'] . '
Question 1:  ' . $_POST['q1'] . '
Question 2:  ' . $_POST['q2'] . '
Question 3:  ' . $_POST['q3'] . '
Question 4:  ' . $_POST['q4'] . '
Question 5:  ' . $_POST['q5'] . '
Question 6:  ' . $_POST['q6'] . '
Question 7:  ' . $_POST['q7'] . '
Question 8:  ' . $_POST['q8'];


And find

<TD width = "25%">Explain to us how you percieve your character's role in a guild and why:</TD>


Replace with

<TD width = "25%">Explain to us how you percieve your character\'s role in a guild and why:</TD>


Give that a try  :up:
Title: Re: [Done!] Join Us! form
Post by: Anthea on August 30, 2009, 09:20:08 PM
Wow thank you so much!

I appreciate it!

I will give it a try now :)