Jump to content

Marcos01

Members
  • Posts

    62
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Marcos01's Achievements

Member

Member (2/5)

0

Reputation

  1. Crayon Violent, thanks for looking into this. Form is a bit long. I limited to the input. I hope that is enough. echo '<input type="'.$row2['type'].'" name="'.sprintf("%02d%02d",$row2['page'], $row2['questionnumber']).'" value="'.$row2['responsenum'].'"'; $currentquestion = $row2['questionnumber']; $query = "SELECT * from formanswers where page='$currentpage' and sessionid='$sessionid' and questionnumber='$currentquestion' ORDER BY questionnumber"; $result = mysql_query($query, $bkdb) or die("current page could not be found"); $row = mysql_fetch_array($result); $CUR_QNUM = $row['questionnumber']; $CUR_RNUM = $row['responsenum']; if ($row2['questionnumber']==$CUR_QNUM && $row2['responsenum']==$CUR_RNUM) { echo "checked"; $row = mysql_fetch_array($result); } echo ' />';
  2. Does anyone know how to deal with this? Thanks
  3. When I try this foreach ($_POST[sprintf("%02d%02d", $i,$j)] as $test) { echo "$test <br />"; } I get this error: Warning: Invalid argument supplied for foreach()
  4. Crayon Violent, thanks for your reply I would like to do it with a loop. However I am not so good with php so how do I handle that?
  5. Hello, I want to store multiple checkbox values from 1 question. It saves only one value. Checkbox name:sprintf("%02d%02d", $i,$j) value: $_POST[sprintf("%02d%02d", $i,$j)] I can't figure it out. Thanks for your help. for ($i=1; $i <= $highpage; $i ++) { for ($j=1; $j <= $maxquestions ; $j ++) { if ( isset($_POST[sprintf("%02d%02d", $i,$j)])) { $query = "INSERT INTO `bkdb`.`formanswers` (page , questionnumber, responsenum, sessionid) values('$i','$j','".$_POST[sprintf("%02d%02d", $i,$j)]."','$sessionid')"; echo "<p>$query</p>"; mysql_query($query, $bkdb) or die("Could not save last page answers"); } } }
  6. ok here it is: for ($i=1; $i <= $highpagina; $i ++) { for ($j=1; $j <= $maxquestions ; $j ++) { if ( isset($_POST[sprintf("%02d%02d", $i,$j)])) { echo 'Name:'.sprintf("%02d%02d", $i,$j).' Value='.$_POST[sprintf("%02d%02d", $i,$j)].'<br>'; //=========skip questions $name = sprintf("%02d%02d", $i,$j); if ($name==0401 && $_POST[sprintf("%02d%02d", $i,$j)]==2) { echo "need to skip questions and goto page 12"; } $query = "INSERT INTO `bkdb`.`formanswers` (page ,questionnumber, responsenum, sessionid) values('$i','$j','".$_POST[sprintf("%02d%02d", $i,$j)]."','$sessionid')"; echo "<p>$query</p>"; mysql_query($query, $bkdb) or die("Could not save last page answers"); } } }
  7. Ok thanks, here is more code: Here is the input: echo '<input type="'.$row2['type'].'" name="'.sprintf("%02d%02d",$row2['pagina'], $row2['questionnumber']).'" value="'.$row2['responsenum'].'"/>'.$text.'<br />'; $name = sprintf("%02d%02d", $i,$j); if ($name==0401 && $_POST[sprintf("%02d%02d", $i,$j)]==2) { echo "need to skip questions and goto page 12"; }
  8. flyhoney, thanks for your reply. There is no problem with the value(i wrote variable) but with the name.
  9. hello, I want to skip a question in the form i have. input name = sprintf("%02d%02d", $i,$j) variable = $_POST[sprintf("%02d%02d", $i,$j)] The variable works but the input name doesn't. I don't see what is wrong. Thanks for your help. $name = sprintf("%02d%02d", $i,$j); if ($name==0401 && $_POST[sprintf("%02d%02d", $i,$j)]==2) { echo "need to skip questions and goto page 12"; }
  10. I have 11 pages with questions. Generated from a database.
  11. Hello ProjectFear, thanks for your help. With the foreach code I get more data then I need. It also gives me the name of the button. I have questionnumber and page in the name and the answer in the value. No clue if it can be done differently.
  12. Hello, I would like to know if it is possible to print/echo the name from a input type radio instead of the value. I am trying to do it with this simple form: $A='0101'; print($_POST['\"$A\"']); echo '<form id="form " name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'">'; echo '<label>question '; echo '<input type="radio" name=\"$A\" id="q1" value="10" />TEST</label>'; echo '<input name="next" type="submit" /> </form>';
  13. It is posted to itself. I am not sure on how to do this.
×
×
  • 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.