PDA

View Full Version : PHP vs. CGI/Perl



Kate
09-02-2005, 12:16 AM
I am going to start learning either one of these languages. I am wanting to make a login/sign up system for my site which will enable users to post comments/reviews for bands and add their own bands. Which code would be easier to learn and more suitable for what I am wanting to make?
Thanks.

AndyH
09-02-2005, 12:28 AM
PHP

Don't make the mistake of using Perl.

Rebuilding a website because Perl was too slow was a pain, a big pain. Learn from my mistake ;).

MarkB
09-02-2005, 01:01 AM
PHP is much easier to learn :)

Blue Cat Buxton
09-02-2005, 01:05 AM
Yes, PHP is easier to learn. When I started to look at CGI / Perl it just had me in circles whereas with PHP you can do a lot quite easily.

Kate
09-02-2005, 01:09 AM
Well, I just completed 2 simple tutorials, one in each language. And, I have to say, I got through the PHP one much quicker and it is was a much cleaner code. Looks like I am going to go with PHP :).

James
09-02-2005, 03:19 AM
PHP. Perl's a vicious troll.

Masetek
09-02-2005, 12:32 PM
PHP is the way forward and easy to learn. There's plenty of good books around on it. Tutorials are good, but I reckon learning from a book from the beginning will give you a better understanding of the lang

:)

r2d2
09-02-2005, 01:07 PM
Just editting some Perl at the moment, and I would definitely recommend PHP - Perl is the work of the devil.

(Its a datafeed script a mate gave me, Perl is apparently good for massive SQL work, so I just edit where necessary, and ignore the scary looking syntax...)

freekrai
09-02-2005, 01:28 PM
Well, I've worked in both as well as several other languages at one point or another.
PHP is the language I use for web sites. Hand downs, you get better coding, faster development and faster web sites.
Perl is the language I use for scripts that will run on the server as cron jobs, or server maintenance, etc.
Perl can be easy and it can be fast, but you've gotta work with it.
But for web sites, Stick with PHP.

ozgression
09-02-2005, 06:07 PM
Learn PHP. PHP is more useful if you are interested in publishing websites (although, i know neither - I pay people to code for me :)).

James
09-02-2005, 07:25 PM
Is that 'useless' supposed to be 'useful', ozgression?

Kate
09-02-2005, 10:24 PM
I bought a few books on PHP today. Hopefully it won't take too long to gte through them :).

ozgression
09-03-2005, 01:40 AM
Is that 'useless' supposed to be 'useful', ozgression?

Yeah, thanks for drawing that to my attention.

Kate
09-06-2005, 04:03 AM
Oh joy! Looks like I just completed step 1 on my road to becomming a PHP champ. I made the contact form on my site!!! Do I rock or what? ;)

I previously had a non-working one I made in CGI. It worked for all of 2 minutes before I decided to spruce it up and busted it.

MarkB
09-06-2005, 04:36 AM
Congrats! Next step: full-blown CMS :p

Kate
09-06-2005, 05:53 AM
Ohh ohhh, update on my PHP learning progress - Beginning of the comments system. (http://pretty-in-punk.com/page3.html) (scroll to the bottom of the page). Very messy and bad at the moment. But still - yay :)!

Blue Cat Buxton
09-06-2005, 07:28 AM
Action is the best way to learn!

The New Guy
09-06-2005, 08:18 AM
filter the html ;)

http://ca3.php.net/manual/en/function.strip-tags.php

ASP-Hosting.ca
09-06-2005, 09:05 AM
For what you need I would recommend PHP.

Kate
09-06-2005, 02:38 PM
filter the html ;)

http://ca3.php.net/manual/en/function.strip-tags.php

Haha, good idea, I will do that now.

Edit: Hmm, I seem to be having a bit of trouble, here is what I have -

$text = '("<p><b>$msgTitle</b> $msgTxt<br><div align=right>
$hr:$min $timetype | $mo/$da/$yr | $msgId, <a href='$url'>$SigName</a></div></p>");
} ';
echo strip_tags($text);
echo "\n";

// Allow <p>
echo strip_tags($text, '<p>', '<b>', '<br>', '<div align=right>', '<a href=>');
?>

And it gives this error -
Parse error: parse error, unexpected T_VARIABLE in /home/prettyin/public_html/comments.php on line 39

Kate
09-06-2005, 03:53 PM
Problem 2 -
I have tried to make it so the comments show up on the band page, like so. (http://www.pretty-in-punk.com/page3.php) But as you can see, they all overlap.
Here is the code I am using to echo the comments:

echo("
<p><div id=\"text11\" style=\"position:absolute; overflow:hidden; left:191px; top:953; width:547px; height:723px; z-index:34\">
<div class=\"wpmd\">
<div><font class=\"ws12\"><B>$msgTitle</B></font></div>
<div><font color=\"#FFFFFF\">$hr:$min $timetype | $mo/$da/$yr | $msgId,</font> <a href=\"$url\">$SigName</a></div>
<div>------------------------------------------------------------------------------</div>
<div>$msgTxt</div>
</div>
</div></p>\n");
}

Can anyone see what the problem is?

Sorry if I am being an annoying PHP-failure.

r2d2
09-06-2005, 04:30 PM
Problem 2:

You need to get rid of the style=\"position:absolute; overflow:hidden; left:191px; top:953; width:547px; height:723px; z-index:34\"

You also shouldnt really have <div>s inside <p>s.

Try redoing that echo as:



echo("
<h3 class=\"ws12\">$msgTitle</h3>
<p>$hr:$min $timetype | $mo/$da/$yr | $msgId, <a href=\"$url\">$SigName</a></p>
<p>$msgTxt</p>
");

r2d2
09-06-2005, 04:33 PM
Problem 1:

Looks like you have got a bit out of control with the open/close tags in here somewhere:


$text = '("<p><b>$msgTitle</b> $msgTxt<br><div align=right>
$hr:$min $timetype | $mo/$da/$yr | $msgId, <a href='$url'>$SigName</a></div></p>");
} ';

Not quite sure what you meant it to be, but it looks like it would cause trouble.

Sorry the answers are the wrong way round :rolleyes:

Also, problem 2 is more HTML/CSS problem, not PHP.

Kate
09-06-2005, 05:02 PM
Problem 2:

You need to get rid of the style=\"position:absolute; overflow:hidden; left:191px; top:953; width:547px; height:723px; z-index:34\"

You also shouldnt really have <div>s inside <p>s.

Try redoing that echo as:



echo("
<h3 class=\"ws12\">$msgTitle</h3>
<p>$hr:$min $timetype | $mo/$da/$yr | $msgId, <a href=\"$url\">$SigName</a></p>
<p>$msgTxt</p>
");



That is what I originally had, but the problem with that is, is it doesn't go within the pink comments box. Thanks.


Edit: I figured out how to stop the text overlaying. Now I just need to work out how to make the box extend in length when more comments are added. And how to filter the html.

Edit 2: HTML = filtered :cool:.