PDA

View Full Version : Whats wrong with my code :(



Decode
24-02-2008, 10:57 AM
Im new to php and i cant figure out whats wrong.
I want it so that when you go to mysite.com/index.php?page=1 it includes pages/1.txt. This is the code;


<?php
$page = input($_GET['page']);
include("pages/' . $page . '.txt");
?>

EDIT: The error message is Fatal error: Call to undefined function input() in C:\wamp\www\index.php on line 12

RYANNNNN
24-02-2008, 11:52 AM
Is that your only code? Because input() is a function, but you have no code that defines the function.


<?php
$page = $_GET['page'];
include("pages/" . $page . ".txt");
?>

Although, I'd definitely clean that $_GET.

Agnostic Bear
24-02-2008, 02:23 PM
Is that your only code? Because input() is a function, but you have no code that defines the function.


<?php
$page = $_GET['page'];
include("pages/" . $page . ".txt");
?> Although, I'd definitely clean that $_GET.

Why, it can't do anything apart from maybe navigate round your files.

Want to hide these adverts? Register an account for free!