Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: Problem with Dreamweaver Trying to get A Dynamic Data...

  1. #21
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Code:
    <?php
    $filename = 'data.txt';
    
    $name = $_POST['name']; 
    $email = $_POST['email'];
    $VideoTitle = $_POST['VideoTitle'];
    $Description = $_POST['Description'];
    
    $somecontent = " '".$name."' , '".$email."' , '".$VideoTitle."' , '".$Description."' ,"; 
    // Let's make sure the file exists and is writable first.
    if (is_writable($filename)) {
    
        // In our example we're opening $filename in append mode.
        // The file pointer is at the bottom of the file hence
        // that's where $somecontent will go when we fwrite() it.
    
        if (!$handle = fopen($filename, 'a')) {
             echo "Cannot open file ($filename)";
             exit;
        }
    
        // Write $somecontent to our opened file.
        if (fwrite($handle, $somecontent) === FALSE) {
            echo "Cannot write to file ($filename)";
            exit;
        }
    
        echo "Success, wrote ($somecontent) to file ($filename)";
    
        fclose($handle);
    
    } else {
        echo "The file $filename is not writable";
    }
    ?>
    Thats what I have now

  2. #22
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    I still haven't gotten this, if someone could just tell me what to put... then I would be fine.

  3. #23
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default Ok I might have this all i need is a little tweaking...

    OK i got it to work... its really quite neat!

    ok so on the HTML Page *or the form page* u put this:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    
     Name
    <form method="POST" action="data.php" name="">
     Your Name:<input type="text" name="text" value="text" />
     Your Name:<input type="text" name="text2" value="text" />
     Your Name:<input type="text" name="text3" value="text" />
     Your Name:<input type="text" name="text4" value="text" />
    
     <input type="submit" />
     </form>
     
    </body>
    </html>
    Edit it to your standards
    Then put this into the Data.php page:
    PHP Code:
    <?php
    $var 
    $_POST["text"];
    $var2 $_POST["text2"];
    $var3 $_POST["text3"];
    $var4 $_POST["text4"];
    echo 
    "Please Fill Out The Form Below"
    ?>
    <?php 
    $filename 
    'data.txt'
    $somecontent "
    <br />Your Name: 
    $var
    <br />Your EmailAddress: 
    $var2
    <br />Your Password: 
    $var3
    <br />Your Password: 
    $var4
    <br />End of Form"

    // Let's make sure the file exists and is writable first. 
    if (is_writable($filename)) { 

        
    // In our example we're opening $filename in append mode. 
        // The file pointer is at the bottom of the file hence 
        // that's where $somecontent will go when we fwrite() it. 
        
    if (!$handle fopen($filename'a')) { 
             echo 
    "Cannot open file"
             exit; 
        } 

        
    // Write $somecontent to our opened file. 
        
    if (fwrite($handle$somecontent) === FALSE) { 
            echo 
    "Cannot write to file"
            exit; 
        } 

        echo 
    "Success, your content to the database)"

        
    fclose($handle); 

    } else { 
        echo 
    "The file is not writable"

    ?>
    Thats what worked for me! Thanks

Bookmarks

Posting Permissions

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