Jump to content


Photo

Getting variable from URL without reloading.


  • Please log in to reply
No replies to this topic

#1 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 18 September 2006 - 07:32 PM

On top of a page, i have this:

<a href="#?page=home" onclick="getData('home.html', 'newseditor')">Home</a>

This will open the page "home.html" into a textarea so the client can edit it from his browser.

Then i have the form, followed by

if(isset($_POST['submit'])) {
	
	$editted = $_POST['page_to_edit'];
	$fp = fopen($filename, "w") or die ("Could not open $filename. Make sure the file exists.");
	fwrite($fp, $editted);
	fclose($fp);
}

The problem is here:
$filename = $_GET['page'];


So when he clicks
<a href="#?page=home" onclick="getData('home.html', 'newseditor')">Home</a>

i need to get the variable 'home', but it won't do it.

So, how can i make php know which file is it going to write to?

Thank you.
regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users