1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: basic php - combining text?

Discussion in 'Web Design & Development' started by knight_47, Apr 3, 2010.

Thread Status:
Not open for further replies.
  1. knight_47

    knight_47 Thread Starter

    Joined:
    Mar 14, 2006
    Messages:
    941
    hey guys,

    basic php question here, havn't done php in a bit and am a bit rusty lol.

    all code:
    PHP:
    $<?php 

    // variabalize everything first for easiness 
    $name $_POST['name'];
    $cat $_POST['cat'];
    $body $_POST['body'];
    $pass $_POST['pass'];
    $code $name <br /> $cat <br /> $body";


    if (
    $_POST['submit'])
    {
        
    $filename "$name + $cat.html $random"// would this be the proper way to combine text???
        
    $create fopen($filename'w') or die("The file could not be created, please try again later");
        
    fwrite($create$code);
        
    fclose($create);
        echo 
    '<meta HTTP-EQUIV="REFRESH" content="0; url=' $filename '.html">';
      
    }



    ?>
    my question is, this line:
    PHP:
    $code $name <br /> $cat <br /> $body";
    would this be the proper way to combine the text from these variables? <br /> is just a break.

    also, on this line:
    PHP:
      echo '<meta HTTP-EQUIV="REFRESH" content="0; url=' $filename '.html">';
    would that also be the proper way to combine the text?? i'm getting an error on this specific line.
    the final html output should be:
    <meta HTTP-EQUIV="REFRESH" content="0; url=FILE_NAME.html">

    basically redirects to the created page.

    any other issues in my code? kind of rusty.

    thanks for all your help.
     
  2. MMJ

    MMJ Guest

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    $
    PHP:
    <?php 

    // variabalize everything first for easiness 
    $name $_POST['name'];
    $cat $_POST['cat'];
    $body $_POST['body'];
    $pass $_POST['pass'];
    $code $name '<br />' $cat '<br />' $body;


    if (
    $_POST['submit'])
    {
        
    $filename $name '+' $cat '.html' $random// would this be the proper way to combine text???
        
    $create fopen($filename'w') or die("The file could not be created, please try again later");
        
    fwrite($create$code);
        
    fclose($create);
        echo 
    '<meta HTTP-EQUIV="REFRESH" content="0; url=' $filename '.html">';
      
    }



    ?>
     
  3. knight_47

    knight_47 Thread Starter

    Joined:
    Mar 14, 2006
    Messages:
    941
    ahh i forgot all about the .'s lol.

    thank you very very much.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/914567

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice