Jump to content

PHP variable passing through URL - Not Working!!


jt327

Recommended Posts

Hey Guys,

I know this is a common problem for people new to php, and ive done a lot of research before posting but so far cannot get it working. My problem is:

i am trying to pass variables to a html page through the url : http://url.com/index.php?id=123&var=0 but am having trouble getting the variable from the other page.

should i be doing something like..

<?php

$var= $_GET['var'];
echo "the variable is: $var";

?>

If so is there a problem with this code? Will that php code work fine imbedded in a plain html file? or will i have to add somethin else? any help would be massively appreciated

Thanks in advance,

Jared
well basically ive got a html page which im trying to adapt to php to work with my content management system. in the html file ive got a javascript function call which passes one of the variables passed to the page. somehting like..

myFunction(var);

what im trying to do is read in the var from the

<?php
$var= $_GET['var'];

?>

and then pass it to myFunction(). Im not the best coder so im not sure about the best way to go about this.

Jared.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.