Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.