Old 19-08-2004, 05:03   #1 (permalink)
lattyware
 
Posts: n/a
PHP Help

I am trying to work out why this dosn't work - I have one page with this on:

Code:
<?PHP $name = "Test"; $disc = "Test"; ?> <table border="0"> <tr> <td>Name: <?PHP Echo $name ?></td> </tr> <tr> <td>Description: <?PHP Echo $disc ?></td> </tr> <tr> <td> Voting Link: <a href="../vote.php?name=<?PHP echo $name ?>">http://www.lattyware.com/THL/vote.php?name=<?PHP echo $name ?></a> </td> </tr> </table>

And another page with this on:

Code:
<?PHP $name=$_Get["name"] $fp = fopen("files/votes/".$name.".txt","r"); $votes = fread ($fp, filesize ("files/votes/".$name.".txt")); fclose($fp); $votes++; $fp = fopen("files/votes/".$name.".txt","w"); fwrite($fp, $votes); fclose($fp); echo "<BR> You Vote Has Been Cast. $name s Toatal $votes <BR>"; ?> <input type="button" value="Continue..." onclick="window.location='stats.php'">

Everything works except for the passed variable ($name) Please help.
  Reply With Quote
Old 19-08-2004, 05:08   #2 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,643
if you're passing the var in the URL you should just be able to use it...

$name

no real need for

$name=$_Get["name"]

or I could be overlooking something...
  Reply With Quote
Old 19-08-2004, 05:11   #3 (permalink)
lattyware
 
Posts: n/a
When I put in $name=$_Get["name"] -
Notice: Undefined variable: _Get in C:\Domains\lattyware.com\wwwroot\THL\vote.php on line 9

When I don't.
Notice: Undefined variable: name in C:\Domains\lattyware.com\wwwroot\THL\vote.php on line 9
  Reply With Quote
Old 19-08-2004, 05:12   #4 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,512
Also,

<a href="../vote.php?name=<?=$name?>">http://www.lattyware.com/THL/vote.php?name=<?=$name?></a>
__________________
  Reply With Quote
Old 19-08-2004, 05:13   #5 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,512
Quote:
Originally Posted by lattyware
When I put in $name=$_Get["name"] -
Notice: Undefined variable: _Get in C:\Domains\lattyware.com\wwwroot\THL\vote.php on line 9

$_GET["variable"]
__________________
  Reply With Quote
Old 19-08-2004, 05:16   #6 (permalink)
lattyware
 
Posts: n/a
That hasn't made a difference either...
  Reply With Quote
Old 19-08-2004, 05:18   #7 (permalink)
lattyware
 
Posts: n/a
Correction: It works now - thank you!
  Reply With Quote
Old 19-08-2004, 05:22   #8 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,643
When I loose the

$name=$_Get["name"]

in the code posted above and test it locally on my machine it all works fine (bar the permissions - too lazy to set that up right now). No problems with the var though.

Could this be a set up problem on the server your using? anyone? that'd be beyond me.
  Reply With Quote
Old 19-08-2004, 05:29   #9 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,512
Quote:
Originally Posted by lattyware
Correction: It works now - thank you!

no problem
__________________
  Reply With Quote
Old 19-08-2004, 07:41   #10 (permalink)
stickmus
hmmm...
 
stickmus's Avatar
 
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,127
Quote:
Originally Posted by dan
Could this be a set up problem on the server your using? anyone? that'd be beyond me.

The server has register globals set to off, default since version 4.2

http://uk2.php.net/register_globals
  Reply With Quote
Old 19-08-2004, 10:26   #11 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,643
Hmm, I see.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8