0

I have this page called up.php that adds 1 to a txt file set with all permissions.

<?php

$name = file_get_contents("name.txt");

if(!file_exists('number.txt')){
file_put_contents('number.txt', ((int) file_get_contents('number.txt')) + 1);
header('Location: "$name.txt");
} 

?>

I have a form action button that runs this php page, however the browser comes back with this:

Parse error: syntax error, unexpected $end in /up.php on line 10.

I am lost here. Any ideas on why this is happening?

3 Answers 3

1

You're just have unbalanced quotes, change header('Location: "$name.txt"); to header('Location: "$name.txt"');

Sign up to request clarification or add additional context in comments.

Comments

1

You're missing a single quote in the header() line.

Comments

1

I looks like you're missing a closing single-quote on the header() line.

1 Comment

Ah - I'm also being slow. I did answer first, but who cares :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.