PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
What do I need to do to addnews.php so that extra pipe symbols are not written to my textfile ( news.txt ) every time the page is visited and exited
( whether an update has been made or not.... )
that's exactly what I have been after....your script has an error somewhere ( Parse error: parse error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in /home/virtual/site130/fst/var/www/html/internal/view.php on line 19 ) but cheers for posting it. I'll have to continue thsi tommorrow- too much other work to do, but cheers.
Tja, regex....that would definitely be prettier than my proposal. But they're not my strongest point... actually I'm wrestling myself through them at the moment.
if(isset($_SERVER['submit']))
// or if prefered...
if(isset($HTTP_POST_VARS['submit']))
// or if you want the submit button to be some sort of Update-button..
if(isset($_SERVER['submit']) and !empty($_SERVER['news']))
// or if prefered...
if(isset($HTTP_POST_VARS['submit']) and !empty($HTTP_POST_VARS['news']))
isset = is it set (pressed)
!empty = is it not set or ""
Cheers Derfel Cadarn I have used this and it works.
Cheers also Jam - I have looked at regular expressions with fear and terror before, so I think that before I slap a bit of code around, I will print off some thorough tutorials and really learn what they are about.
Cheers for all your help everybody, it is very much appreciated.
<?php
// Backward compatible array creation. After this point, the
// PHP 4.1.0+ arrays can be used to access variables coming
// from outside PHP. But it should be noted that these variables
// are not necessarily superglobals, so they need to be global-ed!
if (!isset($_SERVER)) {
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
$_ENV = &$HTTP_ENV_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
$_COOKIE = &$HTTP_COOKIE_VARS;
$_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
}
?>
This way I can use the "new" code, whish is shorter and easier to me and I don't have to think about what PHP-version is on the server. But I didn't want to bother mesz with it...