Solved: basic php - combining text?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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.
 

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">';
  
}



?>
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Top