Jump to content

Echo


hilda

Recommended Posts

I am trying to use a echo statement and push out a link. I am not sure how to do this but I figured I would post on here and ask.

 

<?PHP

 

$filename = "file.txt"; #Must CHMOD to 666

$text = $_POST['action']; # Form must use POST. if it uses GET, use the line below:

#$text = $_GET['theformfieldname']; #POST is the preferred method

 

$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents

if ($fp) {

fwrite ($fp, $text);

stripslashes($text);

fclose ($fp);

echo ("I would like to put an HTML Page or code in here." );

}

else {

echo ("I would like to put an HTML Page or code in here");

}

 

?>

 

 

Any help would great.

Link to comment
https://forums.phpfreaks.com/topic/136267-echo/
Share on other sites

<?PHP

$filename = "file.txt"; #Must CHMOD to 666
$text = $_POST['action']; # Form must use POST. if it uses GET, use the line below:
#$text = $_GET['theformfieldname']; #POST is the preferred method

$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $text);
stripslashes($text);
fclose ($fp);
header('Location http://www.example.com/otherpage.php');
}
else {
header('Location http://www.example.com/otherpage2.php');
}

?>

Link to comment
https://forums.phpfreaks.com/topic/136267-echo/#findComment-711566
Share on other sites

<?php

$filename = "file.txt"; #Must CHMOD to 666
$text = $_POST['action']; # Form must use POST. if it uses GET, use the line below:
#$text = $_GET['theformfieldname']; #POST is the preferred method

$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, $text);
stripslashes($text);
fclose ($fp);
header('Location http://www.example.com/otherotherpage.php');
}
else {
header('Location http://www.example.com/otherpage.php');
}

?>

 

Not within the echo, replace the echo code with it.

Link to comment
https://forums.phpfreaks.com/topic/136267-echo/#findComment-711567
Share on other sites

Ok so i used the code below and still no dice. It uploads the data but wont redirect me to that page. Not sure what is the issue but I do know it's driving me nuts  ??? I have tried to do some research before bothering your all but I am at a stand still. Any help would be great.

 

 

<?php

 

$filename = "file.txt"; #Must CHMOD to 666

$text = $_POST['action']; # Form must use POST. if it uses GET, use the line below:

#$text = $_GET['theformfieldname']; #POST is the preferred method

 

$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents

if ($fp) {

fwrite ($fp, $text);

fclose ($fp);

header('Location http://www.example.com/otherotherpage.php');

}

else {

header('Location http://www.example.com/otherpage.php');

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/136267-echo/#findComment-711670
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.