Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012
    Posts
    2

    Unanswered: Php Writing File

    i am writing a file here is the code and html form but it's only writing the single quotes kindly help me
    HTML Code:
    <html>
    <head>
    <title>
    Quiz Submit</title>
    </head>
    <body>
    <form action="pro.php" method="post">
    Q No_: <input type="text" name="no"  /><br />
    <br />
    Question: <input type="text" name="q" /><br /><br />
    Option 1: <input type="text" name="o1" /><br />
    Option 2: <input type="text" name="o2" /><br />
    Option 3: <input type="text" name="o3" /><br />
    Option 4: <input type="text" name="o4" /><br />
    <input type="Submit" value="Submit" /><br />
    
    </form> 
    </body>
    </html>
    PHP Code:
    <?php
    $num
    $_POST['no'];
    $que$_POST['q'];
    $op1$_POST['o1'];
    $op2$_POST['o2'];
    $op3$_POST['o3'];
    $op4$_POST['o4'];
    $fpfopen("quiz.html""a");
    $qnum="one more";
    $qnum ="'<div class=question>' . $q . '</div>'";
    $opt1 ="'<div class=option>'.$o1.'</br>' .$o2 . '</br>' . $o3 .'</br>' . $o4 . '</br>' . '</div>'";
    $savestring$qnum $opt1;
    fwrite($fp$savestring);
    fclose($fp);
    echo 
    "<h1>You data has been saved in a text file!</h1>";
    ?>

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what are $o1, $o2, $o3 & $o4 ?
    where are those variable set?
    from your code I'd expect to see only
    Code:
    one more'<div class=option>''</br>''</br>''</br>''</br>' . '</div>'";
    in your file
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2012
    Posts
    2

    So what i have to do ?

    kindly repair my code this is a quiz template like there is
    a question and it has 4 options
    then i want to put my quiz in a div tag like when it write a file it shows
    question in div and options in div then so the $o1, $o2, $o3, and $o4 are the options variables get from options.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so at what point do you think you set $o1...$o4?
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •