TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 361
  • Total: 362
  • tino

[Done!] Join Us! form

Started by mebymyself, October 19, 2006, 08:10:13 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Hairy

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.

revscott

#211
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.

Hairy

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:

revscott

Thank you for any help you can offer!   Hope you enjoy work.

forty4420

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?

Hairy

I tested this out and tried some changes but no luck, sorry I can't easily see what's causing an issue  :idiot2:

IchBin

Are you guys changing the article id referenced in the code?

forty4420

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>

';



IchBin

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

lOOmis

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.