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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.