Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Im having problems with writing to files. Could anyone please check my script?

    Okie dokie, I just made sumthing that does the exact same thing this script does, and it worked, now I tried it but changed the look of the page, and it does not want to work... Could you please tell me where I have messed up in the script?? Thanks a bunch!
    Code:
    <?php
    
    $File = "$_POST['type'].txt";
    $Open = fopen($File, "a");
    if ($Open){
    
    fwrite($Open, "<a href='boards/boards.php?type=$_POST['type']&board=$_POST['Num']'>$_POST['Nam']</a>\r\n");
    fclose ($Open);
    
    } else {
    print ("Your file could not be added to the board list due to an error!");
    }
    
    ?>
    <form action="admin.php" method="POST">
    
    <table cellspacing="0" style="border:0px solid black;width:400;">
      <tr>
        <td style="border:1px solid black;width:100;border-right:medium none"><center>Order #</center></td>
        <td style="border:1px solid black;width:633;"><center>Board Name</center></td>
      </tr>
      <tr>
        <td style="border:1px solid black;width:100;border-right:medium none;border-top:medium none;"><center><input type="TEXT" name="Num" size="1"></center></td>
        <td style="border:1px solid black;width:633;border-top:medium none;"><center><input type="TEXT" name="Nam" size="40"></center></td>
      </tr>
    </table>
    Public:&nbsp;<input type="radio" name="type" value="Pub"><br>Private:<input type="radio" name="type" value="Priv"><br>
    <input type="Submit" value="Create New Public Board">
    </form>
    BTW, I do have an HTML page, but its the same as everything thats at the bottom half of my page... Please tell me whats wrong w/ my script! Once again, thanks a TON in advance!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    without a parse error return or some idea of what's not working properly I'd have to guess that that script does actually work.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It tells me it cant find the variables. It says
    Notice: Undefined index: 'type' in c:\program files\apache group\apache\htdocs\nv\boards\admin.php on line 3

    Notice: Undefined index: 'type' in c:\program files\apache group\apache\htdocs\nv\boards\admin.php on line 7

    Notice: Undefined index: 'Num' in c:\program files\apache group\apache\htdocs\nv\boards\admin.php on line 7

    Notice: Undefined index: 'Nam' in c:\program files\apache group\apache\htdocs\nv\boards\admin.php on line 7

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AHh! I figured it out! So simple! Thanks 4 all the help!


  •  

    Posting Permissions

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