Jump to content

BrainCrasher

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

BrainCrasher's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That was very helpful! I modified it so it uses only one button. I learned a new way of formatting code! Thanks for that too!
  2. The form will submit back to the same page.. action="<?php $_SERVER['PHP_SELF']; ?>" I don't know how to create the Insert part with arrays (field[]) .. If that can solve this than please show me how.. I know how to make a radio group with fixed(not from database) value, submit it and write it in a database. But I don't know how to do it with this.. so that's why I didn't write any code for processing... I store the answer to the question in one field. I separate the answers like this: answer1 /answer2 The functions basically take the whole answer field from the database and store it in a string[]. If I echo string[0] it shows answer1, if I echo string[1] it shows answer2.
  3. I need help badly! What I want to do is insert into database the value from the selected radio group buttons.. All of them. There are 10 radio groups total (they can be less, but not more). Thanks! <?php require_once('Connections/strana.php'); mysql_select_db($database_strana, $strana); ?> <link href="css/styles.css" rel="stylesheet" type="text/css" /> <table width="100%" height="100%" style="margin-left:auto;margin-right:auto;" border="0"> <tr> <td align="center"> <form action="" method="post" enctype="multipart/form-data" name="form1"> <table> <?php $tema = mysql_query("SELECT * from prasanja where tip=2")or die(mysql_error()); function odgovor1($string) { $string1 = explode("/", $string); echo $string1[0]; } function odgovor2($string) { $string1 = explode("/", $string); echo $string1[1]; } while ($row=mysql_fetch_array($tema)) { $id=$row['prasanje_id']; $prasanje=$row['prasanje_tekst']; $tekst=$row['odgovor']; ?> <tr> <td> </td> </tr> <tr> <td class="formaP"> <?php echo $prasanje?> </td> </tr> <tr> <td class="formaO"> <p> <label> <input type="radio" name="Group<?php echo $id?>" value="<?php odgovor1($tekst) ?>" /> <?php odgovor1($tekst) ?></label> <br /> <label> <input type="radio" name="Group<?php echo $id?>" value="<?php odgovor2($tekst) ?>" /> <?php odgovor2($tekst) ?></label> <br /> </p></td> </tr> <tr> <td> <br /> </td> </tr> <?php } ?> </table> <input align="left"type="submit" name="submit" value="Внеси" > </form> </td> </tr> </table> prasanje = question tekst/odgovor = answer The answer table: id - primary question_id - the questions ID whose answer is selected in the radio group user_id - cookie takes care of this answer - the value from radio group date - automatic
  4. I've started learning the basics of AJAX.. because I've never used it. I'll see what I can do.. Thanks for pointing out!
  5. I know the difference between do-while and while. I was working in Pascal last semester so.. I got used to write while-do Can you at least give me a hint or some links of examples or anything of how to do this with JS? Thanks..
  6. Not really. I want a way to manual loop through the table. If I have 10 rows, the code I wrote will get them all. question1 <checkbox> <checkbox> question2 <checkbox> <checkbox> question3 .. What I want is a "pausing effect" after each table row. question1 <checkbox> <checkbox> Pause. Click a button is what I want here to continue. question2 <checkbox> <checkbox> And so on.. Is it possible?
  7. 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!!
×
×
  • 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.