Staredit Network > Forums > Technology & Computers > Topic: PHP Ongoing Assistance
PHP Ongoing Assistance
Mar 9 2008, 4:20 pm
By: InsolubleFluff
Pages: 1 2 36 >
 

Mar 9 2008, 4:20 pm InsolubleFluff Post #1



I would like to use this thread when I require assistance with PHP, not just one question, thus it's ongoing, so I am REALLY new to PHP and I am trying to do the simple "Hello World" thing so I got my website set up and within the
Code
<html><body>

and
Code
<html></body> I have

Code
<?php
echo "Hello IsaT I see you";
?>


Yet it does not display on the webpage why is this?



None.

Mar 9 2008, 4:22 pm InsolubleFluff Post #2



woops saved as index.php.txt lawl



None.

Mar 10 2008, 5:01 pm InsolubleFluff Post #3



Okay this time I have actual questions!! :D
if I made templates in php e.g header.php, navigation.php, login.php and main.php
if I were then for the actual page to do this:
filename: index.php
Code
<html>
<body>
<?php include("header.php"."navigation.php"."login.php"."main.php" ?>
</body>
</html>

Q1) Would it be "header.php"."navigation.php"."login.php"."main.php" or "header.php";"navigation.php";"login.php";"main.php" or neither?
Q2) If i were to call these as templates for the layout how would I make text stick within a certain 'panel' but not write the text into the actual file.php?



None.

Mar 10 2008, 5:30 pm InsolubleFluff Post #4



I found that
Code
<?php
include("header.php");
include("login.pho");
include("navigation.php");
include("main.php");
?>

works but is there a shorter concatenated form to that?
Code
if(false)
{
System.out.println("Well then im fine doing tons of includes");
}




None.

Mar 10 2008, 5:56 pm Forsaken Archer Post #5



There is no shorthand way of doing multiple includes that i know of.
I'd use require() instead because missing file = failure.
Code
$required = array("header", "login", "navigation", "main", "footer", "lol");
foreach ($required as $k => $v)
require($v.'.php');

lol?



None.

Mar 10 2008, 8:11 pm InsolubleFluff Post #6



Stupid site that I used was using javascript and I had an onSubmit function which without javascript couldn't work so I just deleted code.

Post has been edited 1 time(s), last time on Mar 10 2008, 8:38 pm by Shocko.



None.

Mar 10 2008, 8:40 pm Forsaken Archer Post #7



lol onsubmit...
staff.php
<?php
echo <<<EOF
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<body>

<form method="post" action="staff.php">
<select name="name">
<option value="home">Home</option>
<option value="forums">Forums</option>
<option value="staff">Staff</option>
<‌input type="submit" value="Go">
</select>
</form>
<br /><br />
EOF;
if ($_POST['name'] == "forums")
echo "in forums";
else if ($_POST['name'] == "home")
echo "in home";
else if ($_POST['name'] == "staff")
echo "in staff";

echo <<<EOF
<br /><br />
</body>
</html>
EOF;
?>




None.

Mar 10 2008, 8:57 pm Centreri Post #8

Relatively ancient and inactive

Maybe you can do require("whatever", "whatever", "whatever");, but I'm too lazy to try it out. You shouldn't use requires/includes too much, if possible, since they do slow down the server reply time. Throwing some of the extra luggage on the browser if you need to link to a js functionlist or a stylesheet would be good, if you're planning on implementing those. <link> tag.

Say, IP, do you have a good tutorial on AJAX or something? I'm not that hot with Javascript, so I need something to take me through it :blush: . I think it'll work magnificently if I start working on my site again if the content is reloaded via ajax, and it wouldn't hurt to do the same for a shoutbox either.



None.

Mar 10 2008, 9:26 pm Forsaken Archer Post #9



Just google AJAX tutorial ;o
The basics are relatively simple and straight forward. There are a lot of AJAX kits you can download and use as well, with all the functions you could ever want already written out.
I have yet to perfect my AJAX so I'm not going to give advice on it ;o



None.

Mar 10 2008, 10:09 pm InsolubleFluff Post #10



I wanted to see if your code works and I get those same chinese characters...

HALP

my code is generating tons of chinese symbols no matter what:
Code
<html>
<body>
Hello
</body>
</html>

there's nothing wrong with that and it generates this:
Quote
਀㰀戀漀搀礀㸀 Hello਀㰀⼀戀漀搀礀㸀 ਀
fixed it, accidently saved as uni-code
nvm fixed it for IE for FFox it's still broken.

Post has been edited 3 time(s), last time on Mar 10 2008, 10:28 pm by Shocko.



None.

Mar 10 2008, 11:07 pm Centreri Post #11

Relatively ancient and inactive

Err.. try using notepad to do it and renaming the file to .htm. Its pretty obviously some program problem. Maybe some other saving issue.



None.

Mar 10 2008, 11:14 pm Forsaken Archer Post #12



already fixed it for him:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />



None.

Mar 10 2008, 11:51 pm InsolubleFluff Post #13



Yes IP helped but I did try re-saving and what not before I had to use that meta thing.



None.

Mar 11 2008, 12:56 am (U)Bolt_Head Post #14



I'm working on my own PHP project now too actually.

I'm what you would suggest as a good PHP compiler/error checker.



None.

Mar 11 2008, 1:12 am Forsaken Archer Post #15



Quote
I'm what you would suggest as a good PHP compiler/error checker.
You asking for one or saying you are one?
If the first, DTBK might have suggestions.



None.

Mar 11 2008, 1:16 am Centreri Post #16

Relatively ancient and inactive

Well, there are no PHP compilers, as far as I know. Error checker.. The best I've found are the default PHP error messages, but there might be better ones.



None.

Mar 11 2008, 1:26 am (U)Bolt_Head Post #17



Quote from isolatedpurity
Quote
I'm what you would suggest as a good PHP compiler/error checker.
You asking for one or saying you are one?
If the first, DTBK might have suggestions.

I didn't reread my post lol.
I'm asking for a php compiler for myself. As far as I can tell the only way for me to know if my code is free of format errors is because a blank page is loaded up instead of what i want.
I'm referring to simple formating errors like opening a parenthesis and not closing it or leaving a semicolon off the end of a statement.



None.

Mar 11 2008, 1:26 am InsolubleFluff Post #18



I passed HTML quiz on w3schools with 100% proud ;)? :P xD!
I did XHTML now (zzz soo whiney)
and im on CSS then I think after CSS is javascript then encorporate it all with PHP and then with MYSQL and pwn sen with pew pew lasers



None.

Mar 11 2008, 1:35 am Forsaken Archer Post #19



A blank page? It should at least show the error in black text. Maybe your php environment has error reporting disabled/hidden?



None.

Mar 11 2008, 1:51 am (U)Bolt_Head Post #20



Quote from isolatedpurity
A blank page? It should at least show the error in black text. Maybe your php environment has error reporting disabled/hidden?

Yeah its blank, my classmates and I set up our own server. I guess i was looking for some way to test it before uploading...

PS. I should see if I pass that W3 schools quiz now cause I learned a lot in the past few weeks.



None.

Options
Pages: 1 2 36 >
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[04:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
Please log in to shout.


Members Online: RIVE, Oh_Man