Jump to content

specialguy

Members
  • Posts

    35
  • Joined

  • Last visited

specialguy's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Here's the error i'm getting : Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/hellkrea/public_html/version3/site/news.php on line 34 Here's the news.php page : <? function News() { if (!isset($_GET['do'])) { $local_file = 'news.nfo'; $file = fopen($local_file , 'r') or die("Couldn't open first place"); while (!(feof($file))) { $news[] = fgets($file, 1000); //Slap each line upto 1000 chars into an array } $servertime = time(); echo date("H:i:s, d M, Y", $servertime) . "rn<br>"; $numitems = count($news); echo "Count : $numitems<br>rn"; for($x=0; $x < $numitems; $x++) { echo $news[$x] . "<br>"; } echo "<a href=" . $_SERVER['PHP_SELF'] . "?do=new>Add News</a>n"; fclose($file); } elseif ($_GET['do'] == "new") { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . "?do=add">n" . "Author<br>" . // THIS WOULD BE LINE 34. '<input type="text" size="15" name="author"><br>' . "News to add :<br>n" . '<textarea rows="20" cols="60" name="new_news">' . '</textarea><br>' . '<input type="submit" name="submit" value="Add News"><br>' . '</form>'; } elseif ($_GET['do'] == "add") { $time = time(); $read_time = date("H:i:s, d M, Y", $time); $unstripped_news = $_POST['new_news']; $new_news = stripslashes($unstripped_news); $author = $_POST['author']; $fpnews = fopen('news.nfo', 'r'); $old_content = fread($fpnews, filesize('news.nfo')); $fp = fopen('news.nfo', 'w'); fwrite($fp, "rn$timern$authorrn$new_newsrn$old_content", (strlen($time) + strlen($new_news) + strlen($author) + strlen($old_content) + 16)); echo "News added successfully. Here is what you posted.<br>n" . "Submitted on $read_time<br>n" . "By : $author <br>n" . "News : <br> n$new_news <br> n"; echo "Back to <a href=" . $_SERVER['PHP_SELF'] . ">news</a>"; fclose($fpnews); fclose($fp); } echo "n<br>n<a href=" . "/news.php" . "s>View my Source!</a>"; echo "n<br>n blah blah blah <a href=news.nfo>news.nfo<a/> : " . filesize('news.nfo'); } ?> Thanks for u help
  2. Nono, here an exemple :Option 1(Are you over 18 or less than 18?)so depending if you choose over 18 in option 1 or less than 18,the option 2 that is ALREADY THERE will show all ages over 18 or all ages that are lower than 18.I hope that helped you understanding my poor english. THanks alot for helping me man.
  3. I really need you guys for a project im doing. so here it is, I'm doing a PHP script that needs some Javascript to show listbox when selecting a choice.So here it is, the guy select something between the couples of choice and then a listbox appear and he can select something else.I really don't know how to do it and I know it isn't long so please could someone help me doing it? or simple gimme some link where there's exemple of it.Thanks alot !
  4. Dunno if you still want an exemple of Div/css but here it is : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title></title><style type="text/css"><!--body { margin: 0px; padding: 0px;}#header { background: #0f0; width: 100%;}#leftcol { background: #f00; float: left; width: 20%; height: 500px;}#rightcol { background: #f00; float: right; width: 20%; height: 500px;}#content { background: #fff; float: left; width: 59%; height: 500px;}#footer { background: #0f0; clear: both; width: 100%;}--></style></head><body><div id="header">Header Section</div><div id="leftcol">Left Section</div><div id="rightcol">Right Section</div><div id="content">Content Section</div><div id="footer">Footer Section</div></body></html>
  5. I really doubt there is a way to do this in PHP >.<
  6. Don't think so it's a good idea to use css when you're using tables.if you wanna use tables, you should put your css into xhtml, and if you wanna use css, then you have to build your xhtml with Divs.
  7. You should post your site's code, that would help peaple to help you.
  8. specialguy

    Gobby

    That seems very awesome dude, Thanks alot.Merry Christmas everyone !
  9. specialguy

    UltiBB

    That seekond project seemed pretty well started though, sad it didn't work out.
  10. That's quite funny cause I also asked Santa to help me with my PHP !
  11. You asked for an exemple of little script so here it is, a script that'll tell you if an email if valid or not. <p><?if (isset($_POST['mail'])){ if (preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $_POST['mail'])) { echo 'The email' . $_POST['mail'] . ' is<strong>valid</strong> !'; } else { echo 'The email' . $_POST['mail'] . 'isnt valid, try again!'; }}?></p><form method="post"><p> <label for="email">Your email ?</label> <input id="mail" name="mail" /><br /> <input type="submit" value="Try the email" /></p></form>
  12. Merry Christmas everyone, hope everything will go find for you in the next year !
  13. Mmmm the lines that are in your codes are pretty much a pain in the ######, you should fix it so peaple could read more easily your code.
  14. I'm questioning myself about this since i've started to learn PHP, and I still really didnt find..In fact, the question's pretty simple. For exemple, you're doing a News system script, i dont understand how you can tell the script(the page where you write your news) to go at a specific place in the Index.I know that's a dumb question, but i didnt figure it out
  15. You can always go there www.php.net/foreach and make sure what you did was all right.
×
×
  • Create New...