I'm quite new to PHP. My scripts work very well on a PHP editor. But when i run them from my browser, the content of my variables do not appear when I print them !!!
Can anyone help me ?
PHP HELP PLZZZZ
Moderator: General Moderators
how are you trying to print them?
from your posts i get the feeling you've never opened a book. fyi: read twig's posting guidlines, because the fact i get that feeling is a bad sign.. it means people are going to stop answering you soon because they feel you want us to do work you should do before bringing questions here. which means either the construction of your questions are bad, or you need to read a book
from your posts i get the feeling you've never opened a book. fyi: read twig's posting guidlines, because the fact i get that feeling is a bad sign.. it means people are going to stop answering you soon because they feel you want us to do work you should do before bringing questions here. which means either the construction of your questions are bad, or you need to read a book
-
yonibensimon
- Forum Newbie
- Posts: 15
- Joined: Thu Aug 07, 2003 10:24 am
This might not be the problem but are you echoing vars in an included html template?
In an html file, you need to jump into php before you can echo (and then jump out again) ie:
The parser won't do anything unless it sees the php tags.
If you are echoing direct from php, the code you posted doesn't have a ";" at the end of the line: are you getting error messages for that?
In an html file, you need to jump into php before you can echo (and then jump out again) ie:
Code: Select all
<?php echo $var; ?>If you are echoing direct from php, the code you posted doesn't have a ";" at the end of the line: are you getting error messages for that?
Last edited by McGruff on Wed Aug 10, 2005 11:12 pm, edited 1 time in total.
-
yonibensimon
- Forum Newbie
- Posts: 15
- Joined: Thu Aug 07, 2003 10:24 am
Scuse me if I'm telling you something you already know but first some basics about scripts.
When a php script has finished, everything associated with it - vars, fn defs etc - disappears. So, in one script you create a form, the script runs and all the vars in that script are gone. When the form is submitted, a new script starts and you have to declare vars again. These will be in the $_POST array (if POST was your form method). If register globals is off, get them with:
.. or just use $_POST['var'] wherever you need it.
When a php script has finished, everything associated with it - vars, fn defs etc - disappears. So, in one script you create a form, the script runs and all the vars in that script are gone. When the form is submitted, a new script starts and you have to declare vars again. These will be in the $_POST array (if POST was your form method). If register globals is off, get them with:
Code: Select all
<?php
$var = $_POST['var']
?>