Hello forum.
I'm new here, but I've been reading and finding useful things for a while now.
I'm still new to PHP and I need a little help.
I'm doing a school project and I have some things I want to do, but do not know how to write it down in PHP.
I think I'll ask a lot of questions this week, and I hope I will get some help..
For start I want to ask this:
I've been using
mysql_fetch_array()
for doing loops and populating check-boxes. And everything's working fine.. but what I want is to control the actual loop by clicking buttons. Let's say first time a while-do is run, my check-boxes get populated from the database and every other loop the next data from the table is added.. pretty straightforward.
I want to be able to populate once, then click "next" and the new data to be added and so on..
<?php
$tema = mysql_query("SELECT * from questions")or die(mysql_error());
function answer1($string)
{
$string1 = explode("/", $string);
echo $string1[0];
}
function answer2($string)
{
$string1 = explode("/", $string);
echo $string1[1];
}
while ($row=mysql_fetch_array($tema))
{
echo mysql_fetch_array($tema);
$tip=$row["tip"];
if ($tip==2)
{
$id=$row['prasanje_id'];
$question=$row['question'];
$answer=$row['answer'];
?>
<label> <?php echo $question?></label><br>
<input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_0" />
<?php answer1($tekst) ?></label>
<label>
<input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_1" />
<?php answer2($tekst) ?></label>
<?php
}
}
?>
I want an alternative to the while-do loop..
Is it possible to do this?
Thanks!!