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: 362
  • Total: 363
  • 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.

Azphat12

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

JPDeni

Okay. :) Obviously, I'm the one who is most confused!! :2funny:

Azphat12

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

JPDeni

I can only debug the whole code, I'm afraid. You'll need to post it so I can see what the problem is.

Azphat12

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

JPDeni

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.

Azphat12

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.

JPDeni

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. :)

Azphat12

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. 

JPDeni

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.