Jump to content

skip form question


Marcos01

Recommended Posts

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";
		}

Link to comment
https://forums.phpfreaks.com/topic/134379-skip-form-question/
Share on other sites

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";
		}

Link to comment
https://forums.phpfreaks.com/topic/134379-skip-form-question/#findComment-699612
Share on other sites

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");
		}
	}
}

Link to comment
https://forums.phpfreaks.com/topic/134379-skip-form-question/#findComment-699713
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.