Jump to content

Recommended Posts

Hello everyone

 

Is there such a thing as nested Forms?

 

I have a quick question is it possible to use one form and do a multiple table insert/update combos?

 

I have a form and when a specific condition is met the form is modified and six extra table row/input “radio”/input “text” field are shown in the form. However the original form normally is used to do an insert into a table. With the extra rows I would like to do an update to a different table

 

The reason I don’t just make it a separate page is because I am trying to control when the table can be modified.

 

 

 

I not sure I follow you

 

do  you suggest I keep one form or make mulitple form on the same page

 

this is what I have now with just one form

<form name="Selectclass" method="POST" action="<?php echo $editFormAction; ?>" >

  <p align="right"> </p>

  <table width="244" border="0" cellpadding="0" cellspacing="0" class="style1">

      <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

    <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

<tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

  <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

  <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

 

 

  <?php

if(($row_Recordset3['charlevel']+1==4)||($row_Recordset3['charlevel']+1==8)||($row_Recordset3['charlevel']+1==12)||($row_Recordset3['charlevel']+1==16)||($row_Recordset3['charlevel']+1==20)||($row_Recordset3['charlevel']+1==24)||($row_Recordset3['charlevel']+1==28)||($row_Recordset3['charlevel']+1==32))

print "<tr><td bgcolor='#999999' colspan='2' class='style3'>Raise Ability </td>";

print '<td width="108">'; 

print '<div align="left">';

print "<tr><td>STR</td><td><input name='score' type='radio' value='str'></td></tr>";

print "<tr><td>DEX</td><td><input name='score' type='radio' value='dex'></td></tr>";

print "<tr><td>CON</td><td><input name='score' type='radio' value='con'></td></tr>";

print "<tr><td>INT</td><td><input name='score' type='radio' value='intell'></td></tr>";

print "<tr><td>WIS</td><td><input name='score' type='radio' value='wis'></td></tr>";

print "<tr><td>CHA</td><td><input name='score' type='radio' value='cha'></td></tr>";

        print '</div></td></tr>'; 

 

}

?>

 

      <tr>

        <td><input type="submit" name="Submit1" value="Select Class" id="Submit1"></td>

        <td><input type="submit" name="Submit2" value="Accept Class" id="submit2"></td>

      </tr>

</table>

  <div align="center">

    <input type="hidden" name="MM_insert" value="Selectclass">

  </div>

</form>

 

The second attempt was to include the second form and inserted in middle of the first form but I don't think it would work ?

 

 

<form name="Selectclass" method="POST" action="<?php echo $editFormAction; ?>" >

  <p align="right"> </p>

  <table width="244" border="0" cellpadding="0" cellspacing="0" class="style1">

      <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

    <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

<tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

  <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

  <tr><input name="something.etc" type="text" value="<?php echo $_POST[somethingetc]?>"></tr>

 

 

  <?php

if(($row_Recordset3['charlevel']+1==4)||($row_Recordset3['charlevel']+1==8)||($row_Recordset3['charlevel']+1==12)||($row_Recordset3['charlevel']+1==16)||($row_Recordset3['charlevel']+1==20)||($row_Recordset3['charlevel']+1==24)||($row_Recordset3['charlevel']+1==28)||($row_Recordset3['charlevel']+1==32))

include_once 'increasestat.php'; //<form method="post" name="increasestats" action="<?php echo $editFormAction;?>">

}?>

 

      <tr>

        <td><input type="submit" name="Submit1" value="Select Class" id="Submit1"></td>

        <td><input type="submit" name="Submit2" value="Accept Class" id="submit2"></td>

      </tr>

</table>

  <div align="center">

    <input type="hidden" name="MM_insert" value="Selectclass">

  </div>

 

 

This is my insert:

 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "Selectclass")) {

  $insertSQL = sprintf("INSERT INTO characterlevels (CharID, charlevel, classlevel, Classid, `Class`, attack_bonus, fortitude, reflex, will, hitpoints, skillpoints,feat) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

                      GetSQLValueString($_POST['CharID'], "int"),

                      GetSQLValueString($_POST['charlevel'], "int"),

                      GetSQLValueString($_POST['classlevel'], "int"),

                      GetSQLValueString($_POST['classid'], "int"),

                      GetSQLValueString($_POST['class'], "text"),

                      GetSQLValueString($_POST['BaseAttackBonus'], "int"),

                      GetSQLValueString($_POST['fortitude'], "int"),

                      GetSQLValueString($_POST['reflex'], "int"),

                      GetSQLValueString($_POST['will'], "int"),

                      GetSQLValueString($_POST['hitpoints'], "int"),

                      GetSQLValueString($_POST['skillpoints'], "int"),

          GetSQLValueString($_POST['feat'], "int"));

 

 

This is my update on a different page "increasestat.php":

 

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "increasestats")) {

  $updateSQL = sprintf("UPDATE createchr2 SET {$_POST['score']}=%s WHERE CharID=%s",

                      GetSQLValueString($totalscore, "int"),

                      GetSQLValueString($_POST['CharID'], "int"));

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.