Page 1 of 1

Xampp vs apache

PostPosted: 16. February 2006 21:24
by Mr_PieChee
right. i have a very simple if:
if (isset($action) && $action == 'add') {

they i set the value to add, but on xampp it don't work yet on theschool system with have apache configured form the binary file, it works fine.

does any one have any ideas why, or it theres anything i can do to fix it?

PostPosted: 16. February 2006 22:32
by Wiedmann
YOu have not an Apache problem, you have a PHP "problem". Please read the manual about "register_globals".

PostPosted: 18. February 2006 15:47
by Mr_PieChee
so i have to set aciton to somehting else first? that makes no sence to me as its the page name...

PostPosted: 18. February 2006 18:55
by Wiedmann
so i have to set aciton to somehting else first?

Please read:
http://de.php.net/manual/en/language.va ... ternal.php

PostPosted: 22. February 2006 13:05
by Mr_PieChee
well i'm stumped! i have know idea how to fix it. i want to make the form apear if the link is clicked. its not the editing data that i have a problem with. the form won't show up:

if (isset($action) && $action == 'folder') {
?>
<form name="formfolder" action=" <?php $_SERVER['PHP_SELF']; ?>?do=addfolder" method="post">
<table><tr>
<td>Name of folder:</td><td> <input type="text" name="name" id="createname"></td></tr>
<tr><td>Description of folder: </td><td><input type="text" name="description" id="description" width="100"></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="createf" value="Create Folder"></td>
</tr></table>
</form>

etc

i just get a blank page, but ht eaddress is right

PostPosted: 22. February 2006 13:46
by Wiedmann
I can not see any link or formfield with the name "action" in the HTML part.

if (isset($action) && $action == 'folder') {

So, where did you define the variable $action?

PostPosted: 25. February 2006 19:06
by Mr_PieChee
arrrr.... i just used a link.. : ie
print '<center>
<a href="admin.php?action=add">Add a Photo</a> :|:
<a href="admin.php?action=edit">Move or Edit a photo</a> :|:
<a href="admin.php?action=folder">Create or remove a folder</a>
</center>';

then if teh varible has been filled in, ie the link clicked, then it works.. but it don't

PostPosted: 25. February 2006 19:31
by Wiedmann
You have read the documantation from my link above?

<a href="admin.php?action=add">Add a Photo</a>

A click on a link is a GET-request. So you can refere this variable as $_GET['action'].

PostPosted: 01. March 2006 00:13
by Mr_PieChee
ok, but how do i define it? i feeling realy retarded at the mo...

how do i set it equal to part of an address?

do i need to have $_GET['action'] = $action?

or go:
if ($_GET($action) && $action == 'folder') {
?

PostPosted: 01. March 2006 01:03
by Wiedmann
ok, but how do i define it?

:?:

You must define nothing...:
1) External GET-variables will not automatically import to the global scope. So you have no $action, but you have $_GET['action'].

Ok, you can assign a external variable to a global one with
Code: Select all
$action = $_GET['action'];

and then work with $action in your code.

2) $_GET is a array like every other array too and you can make the same things with it.

Code: Select all
if (isset($action) && $action == 'folder') {

This should be:
Code: Select all
if (isset($_GET['action']) && ($_GET['action'] == 'folder')) {

You see, no need to import the external variable, you can work diretly with it in this simple case.

PostPosted: 02. March 2006 17:08
by Mr_PieChee
ok, thanks for your help, i'll have a go now

[edit] god like... it works now.. thanks for all your help, and paitence...