PHP Help

J03

~~~~~~~~
Messages
5,558
Location
Wales
Hi All, i have just started learning PHP, and could do with somone in my MSN contact list, to ask a few questions when i am stuck. Anyone interested in helpin a PHP n00b, please add joe@zebrapie.co.uk!!
 
I'm always glad to help people with their web programming questions.

but I'd rather keep it on the forum in public view because then it helps other people as well.
 
OK, so can i ask a Question :) I often see PHP websites with things like, index.php?somecontent. How do i do this? Thanks for all the Help, Joe
 
it's called a get request.

firstly the page is loaded
index.php?variable=hello

then a variable name is passed
index.php?variable=hello

then the data is passed
index.php?variable=hello

to get the data from the address line you simple use either $_GET or $_REQUEST

so
<?php
$variable = $_GET['variable'];

print "the data is $variable";
?>

or
<?php
$variable = $_REQUEST['variable'];

print "the data is $variable";
?>

to pass more than one variable simply put an & in the address line.

index.php?first=hello&second=goodbye
<?php
$variable1 = $_GET['first'];
$variable2 = $_GET['second'];

...

?>
 
I do - I like it how it is all colour coded, and it has got lil things that help you. Anyway, i dont have the time to code my whole website in HTML/PHP :)



Oh, and i managed to do it IN DREAMWEAVER :) (http://joesstuff.co.uk/testpage.php?variable=page)

I placed this:
PHP:
<?php
$variable = $_REQUEST['variable'];
if ($variable == page)
include "htmltest.html"
?>
in the middle of my page template, where i wanted the content to be, and made a HTML page called "htmltest.html" with the actuall content in.
 
-= UPDATE =- Thanks for the Help - I am now in the Prosess of turning one of my websites (joesstuff.co.uk) into a Flash Site! Thanks! (I am sure i will have way more questions, especially about mySQL!
 
Back
Top Bottom