GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-May-2006, 12:06
kiwicas kiwicas is offline
New Member
 
Join Date: May 2006
Posts: 2
kiwicas is on a distinguished road

form not submitting correctly


hi,
Im not sure if im in the right forum......
Im developing a simple new module for the Moodle learning environment and i'm stuck. What exists now is a form with a text area. when submit is pressed, the contents of this area show up on the new page.
however i need three more text areas. I added a new one but the new page just shows two text areas holding the content from only the first text area). Could anyone spare a few minutes to have a look at my code to see where ive gone wrong??
I have a feeling i need to create a second print_textarea function.However, i think that all the modules in Moodle call on this function so If i changed it it might mess everything up.


Thanks in advance

kiwicas

PHP Code:

<?php
  require("$CFG->dirroot/mod/nsolution/lib.php");  // for parameter arrays
  // ...and fill the form if needed

   if (empty($form->name))
    {
        $form->name = "";
    }
   if (empty($form->introduction)) {
            $form->introduction = "";
    }
    if (empty($form->process)) {
                $form->process = "";
    }
    if (!isset($form->gradingstrategy)) {
    $form->gradingstrategy = 1;
  }
    if (empty($form->usemaximum)) {
        $form->usemaximum = 0;
    }
    if (!isset($form->assessmentcomps)) {
        $form->assessmentcomps = 2;
    }
    if (!isset($form->grade)) {
        $form->grade = 100;
    }
    if (!isset($form->gradinggrade)) {
        $form->gradinggrade = 100;
    }
    if (!isset($form->nelements)) {
        $form->nelements = 2;
    }
    if (empty($form->maxbytes)) {
        $form->maxbytes = "";
    }
    if (empty($form->deadline)) {
        $form->deadline = "";
    }
  if (!isset($form->usepassword)) {
        $form->usepassword = 0;
    }
    if (empty($form->showleaguetable)) {
        $form->showleaguetable = "";
    }
    if (empty($form->anonymous)) {
        $form->anonymous = 0;
    }

    $nohtmleditorneeded = true;
?>
<form name="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
    <td align=right><p><b><?php print_string("nsolutionname", "nsolution") ?>:</b></p></td>
    <td>
        <input type="text" name="name" size=60 value="<?php p($form->name) ?>">
    </td>
</tr>
<tr valign="top">
    <td align=right><p><b><?php print_string("introduction", "nsolution") ?>:</b></p>
    <font size="1">
     <?php
        helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
        echo "<br />";
        helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
        echo "<br />";
        if ($usehtmleditor) {
           helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
        } else {
           emoticonhelpbutton("form", "introduction");
        }
      ?>
      <br />
    </font>
    </td>
    <td>
    <?php
       print_textarea($usehtmleditor, 20, 60, 680, 400, "introduction", $form->introduction);

       if ($usehtmleditor) {
           echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
       } else {
           echo '<p align="right">';
           helpbutton("textformat", get_string("formattexttype"));
           print_string("formattexttype");
           echo ':&nbsp;';
           if (!$form->format) {
               $form->format = $defaultformat;
           }
           choose_from_menu(format_text_menu(), "format", $form->format, "");
           echo '</p>';
       }
    ?>
    </td>
</tr>
<tr valign="top">
    <td align=right><p><b><?php print_string("process", "nsolution") ?>:</b></p>
    <font size="1">
     <?php
        helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
        echo "<br />";
        helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
        echo "<br />";
        if ($usehtmleditor) {
           helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
        } else {
           emoticonhelpbutton("form", "introduction");
        }
      ?>
      <br />
    </font>
    </td>
    <td>
    <?php
       print_textarea($usehtmleditor, 20, 60, 680, 400, "process", $form->process);

       if ($usehtmleditor) {
           echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
       } else {
           echo '<p align="right">';
           helpbutton("textformat", get_string("formattexttype"));
           print_string("formattexttype");
           echo ':&nbsp;';
           if (!$form->format) {
               $form->format = $defaultformat;
           }
           choose_from_menu(format_text_menu(), "format", $form->format, "");
           echo '</p>';
       }
    ?>
    </td>
</tr>

</table>
<br />
<center>
<input type="hidden" name=course     value="<?php p($form->course) ?>" />
<input type="hidden" name=coursemodule  value="<?php p($form->coursemodule) ?>" />
<input type="hidden" name=section       value="<?php p($form->section) ?>" />
<input type="hidden" name=module     value="<?php p($form->module) ?>" />
<input type="hidden" name=modulename value="<?php p($form->modulename) ?>" />
<input type="hidden" name=instance   value="<?php p($form->instance) ?>" />
<input type="hidden" name=mode       value="<?php p($form->mode) ?>" />
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="submit" name=cancel value="<?php print_string("cancel") ?>" />

</center>
</form>
Last edited by LuciWiz : 25-May-2006 at 07:42. Reason: Please insert your PHP code between [php] & [/php] tags
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP form needs validation jabesign MySQL / PHP Forum 16 05-Jan-2005 01:23
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 04:38
help with form orbitel MySQL / PHP Forum 11 21-Jan-2004 16:29
Why doesnt my form work correctly? rhino1616 Web Design Forum 2 06-Nov-2003 18:21
validate form skyloon MySQL / PHP Forum 3 15-Jul-2003 10:04

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:06.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.