I have
TP 1.0 Beta 4
SMF: 1.1.10
MODS:
1. Contact Page
2. Aeva ~ Auto-Embed Video & Audio
3. MCLegendII.2
4. TinyPortal 1.075
5. Anti-Spam Verification Questions
6. SMF 1.0.17 / 1.1.9 / 2.0 RC1 Update
7. SMF 1.0.18 / 1.1.10 / 2.0 RC1-2 Update
8. TinyPortal 1.083
I get this error:
Apply Filter: Only show the error messages of this member Guest Today at 07:56:43 AM
Apply Filter: Only show the error messages of this IP address 94.41.70.125 Apply Filter: Only show the error messages of this session 5909f324000ac390b8db49da8b4089e9
Apply Filter: Only show the error messages of this URL http://www.theoaps.com/index.php?page=ApplicationForm
Apply Filter: Only show the errors with the same message
8: Undefined variable: fieldvalue
File: /customers/theoaps.com/theoaps.com/httpd.www/Themes/default/languages/TPShout.english.php (main sub template - eval?)
Line: 405
Here is my application form code:
global $sourcedir, $user_info, $context ;
require_once($sourcedir . '/Subs.php');
require_once($sourcedir .'/Subs-Post.php');
// CONFIGURATION SECTION
$intro_form = "<center><font color=red><h4>
<u>Important Notices for Applicants:</u><br><br>
1) Anti-Bot measure is to ensure that you are indeed a human and not a bot. Failure to choose Yes in the appropriate field will result to send the application to our Junk Folder. <br><br>
</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' => "Anti-Bot Measure",
'name' => "heading7",
'type' => "heading",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Are You Human?",
'name' => "antibot1",
'type' => "select",
'options' => "No,Maybe,Unsure,Yes",
'defaultvalue' => "No",
'required' => 1
),
array(
'caption' => "Info",
'name' => "heading1",
'type' => "heading",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Nick or PID",
'name' => "charname",
'type' => "text",
'options' => "",
'defaultvalue' => "",
'required' => 1
),
array(
'caption' => "Specialization",
'name' => "nickspec",
'type' => "select",
'options' => "Special Forces,Medic,Engineer,Support,Anti Tank,Sniper,Assault",
'defaultvalue' => "80",
'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' => "BF2 Profile",
'name' => "nickprofile",
'type' => "textbox",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Other Games Profile",
'name' => "nickprofileother",
'type' => "textbox",
'options' => "",
'defaultvalue' => "",
'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 Clans?",
'name' => "clanleave",
'type' => "textbox",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you have TeamSpeak and Mic?",
'name' => "tsinfo",
'type' => "select",
'options' => "Yes,No",
'defaultvalue' => "No",
'required' => 0
),
array(
'caption' => "Are you vocal in Teamspeak?",
'name' => "ventvocal",
'type' => "select",
'options' => "Yes,No",
'defaultvalue' => "No",
'required' => 0
),
array(
'caption' => "Do you agree with the General Clan Rules?",
'name' => "guildrules",
'type' => "select",
'options' => "Yes,No",
'defaultvalue' => "No",
'required' => 0
),
array(
'caption' => "Describe your PC Specifications",
'name' => "pcinfo",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you want your application to be kept private, if Yes provide a reason",
'name' => "privateapp",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Why do you wish to join us?",
'name' => "whytojoin",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Introduce yourself to the clan",
'name' => "intro",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Provide link to your stats",
'name' => "stats",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "How many hours a week can you play",
'name' => "howmanyhours",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you have the fullversion + all addons?",
'name' => "fullandadd",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "How long have you played BF2?",
'name' => "history",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you have any clan experience?",
'name' => "experience",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Any further comment?",
'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=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 = '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 = '<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] ' . $_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' => $_REQUEST['charname'],
'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="5" cols="60">';
echo $fieldvalue[$field['name']];
echo '</' . 'TEXTAREA></TD>
</TR>';
}
elseif ($field['type'] == 'heading') {
echo '<tr><TD colspan="2"><center><table cellSpacing="1" cellPadding="1" width="100%"><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 colspan="2" align="center">
<br>
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR></TABLE></center></form>';
}
Anyone that can help me out on this one? I get the error every time i view the application forum.
Greets
Kimmen
Where did this code come from ?
The reason you are getting that error is because you are referring to the variable/array $fieldvalue and it does not exist.
The code is from TP, i had some help setting my site up by Inny, and i did not ask about the error when all was done, i was kinda happy to have the site running again. Anyways, i understand you know my problem, could you please fix it for me? Fixing my code so it is ok?
Above this code:
// There's at least one field missing
if (isset($errors[0])) {
foreach ($_REQUEST as $key => $value)
$fieldvalue[$key] = $value;
Add this line before:
$fieldvalue = array();
IchBin beat me to it ;D
Now i have this error:
Apply Filter: Only show the error messages of this member -=[TLID]=-Kimmen Today at 07:39:21 PM
Apply Filter: Only show the error messages of this IP address 85.200.233.219 Apply Filter: Only show the error messages of this session 244f8579b597d6ce07dbcb80e388c393
Apply Filter: Only show the error messages of this URL http://www.theoaps.com/index.php?page=ApplicationForm
Apply Filter: Only show the errors with the same message
8: Undefined variable: fieldvalue
File: /customers/theoaps.com/theoaps.com/httpd.www/Themes/default/languages/TPShout.english.php (main sub template - eval?)
Line: 406
And this one:
Apply Filter: Only show the error messages of this member -=[TLID]=-Kimmen Today at 07:39:18 PM
Apply Filter: Only show the error messages of this IP address 85.200.233.219 Apply Filter: Only show the error messages of this session 244f8579b597d6ce07dbcb80e388c393
Apply Filter: Only show the error messages of this URL http://www.theoaps.com/index.php?page=ApplicationForm
Apply Filter: Only show the errors with the same message
8: Undefined variable: fieldvalue
File: /customers/theoaps.com/theoaps.com/httpd.www/Themes/default/languages/TPShout.english.php (main sub template - eval?)
Line: 356
And this one:
Apply Filter: Only show the error messages of this member -=[TLID]=-Kimmen Today at 07:39:18 PM
Apply Filter: Only show the error messages of this IP address 85.200.233.219 Apply Filter: Only show the error messages of this session 244f8579b597d6ce07dbcb80e388c393
Apply Filter: Only show the error messages of this URL http://www.theoaps.com/index.php?page=ApplicationForm
Apply Filter: Only show the errors with the same message
8: Undefined variable: scripturl
File: /customers/theoaps.com/theoaps.com/httpd.www/Themes/default/languages/TPShout.english.php (main sub template - eval?)
Line: 346
Those were the errors i got when visiting the application form and reload SMF error log. :-\
Replace the code you have with the code from here --
http://www.tinyportal.net/index.php?topic=29670.0
You will have to redefine your fields.
Try removing the line that IchBin said but instead put it after :
//END OF CONFIGURATION SECTION
Also add the line...
global $scripturl;
...after that so you end up like this :
//END OF CONFIGURATION SECTION
$fieldvalue = array();
global $scripturl;
EDIT : Or do like JP said lol
I tried freddy888's suggestion first, but it still gives me errors.
Then i copy/paste JPDeni's code from the topic she linked me too. And that code gives no errors, but as she said, i would have to do more, i just dunno how to fix it myself :'(
I want it to be the same as i had, but with no errors.
Can you help me?
Greets
Kimmen
You really don't want it to be the same as you had it, because there were several fields that had a "textbox" type. They didn't even show up on your form because "textbox" is not a defined type for a field. You can have "text" or "textarea."
I don't know what else you want, but I copied (and fixed) your fields.
global $sourcedir, $ID_MEMBER, $context, $scripturl, $user_info;
// Guests can't fill out the form
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><font color=red><h4>
<u>Important Notices for Applicants:</u><br><br>
1) Anti-Bot measure is to ensure that you are indeed a human and not a bot. Failure to choose Yes in the appropriate field will result to send the application to our Junk Folder. <br><br>
</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' => "Anti-Bot Measure",
'name' => "heading7",
'type' => "heading",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Are You Human?",
'name' => "antibot1",
'type' => "select",
'options' => "No,Maybe,Unsure,Yes",
'defaultvalue' => "No",
'required' => 1
),
array(
'caption' => "Info",
'name' => "heading1",
'type' => "heading",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Nick or PID",
'name' => "charname",
'type' => "text",
'options' => "",
'defaultvalue' => "",
'required' => 1
),
array(
'caption' => "Specialization",
'name' => "nickspec",
'type' => "select",
'options' => "Special Forces,Medic,Engineer,Support,Anti Tank,Sniper,Assault",
'defaultvalue' => "80",
'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' => "BF2 Profile",
'name' => "nickprofile",
'type' => "text",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Other Games Profile",
'name' => "nickprofileother",
'type' => "text",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Country",
'name' => "charcountry",
'type' => "text",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Why we should pick you?",
'name' => "guildpick",
'type' => "text",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Previous Clans?",
'name' => "clanleave",
'type' => "text",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you have TeamSpeak and Mic?",
'name' => "tsinfo",
'type' => "select",
'options' => "Yes,No",
'defaultvalue' => "No",
'required' => 0
),
array(
'caption' => "Are you vocal in Teamspeak?",
'name' => "ventvocal",
'type' => "select",
'options' => "Yes,No",
'defaultvalue' => "No",
'required' => 0
),
array(
'caption' => "Do you agree with the General Clan Rules?",
'name' => "guildrules",
'type' => "select",
'options' => "Yes,No",
'defaultvalue' => "No",
'required' => 0
),
array(
'caption' => "Describe your PC Specifications",
'name' => "pcinfo",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you want your application to be kept private, if Yes provide a reason",
'name' => "privateapp",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Why do you wish to join us?",
'name' => "whytojoin",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Introduce yourself to the clan",
'name' => "intro",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Provide link to your stats",
'name' => "stats",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "How many hours a week can you play",
'name' => "howmanyhours",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you have the fullversion + all addons?",
'name' => "fullandadd",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "How long have you played BF2?",
'name' => "history",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Do you have any clan experience?",
'name' => "experience",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
array(
'caption' => "Any further comment?",
'name' => "comment",
'type' => "textarea",
'options' => "",
'defaultvalue' => "",
'required' => 0
),
);
//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 = 'Application';
$body = '';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$body .= $field['caption'] . '
';
else
$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 .= $field['caption'] . '<br />';
else
$postbody .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '<br />';
}
$msgOptions = array(
'id' => 0 ,
'subject' => '[Pending] Application of ' . addslashes($_REQUEST['realname']),
'body' => addslashes($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;
}
}
else {
foreach ($fielddef as $field) {
$fieldvalue[$field['name']] = $field['defaultvalue'];
}
}
// 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="' . $_SERVER['REQUEST_URI'] . '" method="post">
<INPUT name="submitted" type="hidden" value="TRUE" />
<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>';
}
}
I highly suggest that you start learning about how to do some of this for yourself if you're going to have a website that uses programming. You can't count on people to fix things for you all the time.
Absolutley pure awsomness Deni :D :up:
Thanks JPDeni :)
Well, i try all the time to learn it by myself, but i am not the sharpest knife etc if you know what i mean. I am however good at managing the forums, but i can't understand code. :'(
I know that i am totally depended on support to get my stuff done, but you can always decline me support.
sorry.
Dont feel bad for asking for help, we do this on free time and because we like to help, if noone gets help it's because we cant help or noone knows the answer at the time.
So if you are the sharpest knife or not, keep come back asking for help cause we will help where we can :)
I tested Denis code she posted in the post before mine and it worked fine :) Did you give it a try ?
Yes, don't feel bad Kim, it's fine to ask :)
Thanks, and yes, the code works with no errors. the only change is that it has no color anymore. The standard text should be color green, to see easy where the answers are. but im fine with it, i don't want to bother deni with my problems, so i can have it like this. Thanks. :)
Greets
Kimmen
In the code you now have, search for
if ($enable_post) { //create new forum post with application
Below that is where the posts are defined.
In your current code, replace
$postbody = 'Recruitment application has been made by ' . $context['user']['name'] .'<br /><br/>';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= $field['caption'] . '<br />';
else
$postbody .= $field['caption'] . ': ' . $_REQUEST[$field['name']] . '<br />';
}
with the following code from your earlier post
$postbody = '<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 .= '';
You'll get your green text back.
Is there anything else that you want?
Thanks JPDeni :)
That should cover it for now, thank you for your time, i am very happy with your support.
Greets
Kimmen