FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

How Tough is PHP - Part II

 


rameshbn1
Hello People,

I'm just starting out in PHP. I posted a question about how tough it is to self-learn php, and was overwhelmed by the response and good advice you people gave me. I understood why its said it's better to learn PHP on the net than learn it from books. I'm following up my last post here.

If these are silly questions, please remember I'm a late starter, and forgive me.

    Is it possible to use PHP side by side with other scripting languages?
    Is the editor we use in making posts implemented in PHP or Javascript? I mean, is it possible to guess at this by seeing the output?
TomS
>>Is it possible to use PHP side by side with other scripting languages

Yes it is. Because PHP is uses HTML to print something on the page, an with php you can use Javascript, Asp and so on.

>>Is the editor we use in making posts implemented in PHP or Javascript? I mean, is it possible to guess at this by seeing the output?

The posteditor in this board is written in Javasdcript. Only the preview- and submit buttons lead to a php-page, which writes your post into the database.
The rest of the board here is all php (the information in profile, actions like "view unanswered posts"). An no you can't guess it by looking at the output. Read the sourcecode. I don't even know, if it's possible with php. And if so, than more complicated and much longer sourcecode.

I learned php from example codes at the beginning, the I used a very simple tutorial for the basics. The rest comes from php.net (functions and their syntax) and some keind of board like this one.
rameshbn1
TomS wrote:

The posteditor in this board is written in Javasdcript. Only the preview- and submit buttons lead to a php-page, which writes your post into the database.
The rest of the board here is all php (the information in profile, actions like "view unanswered posts"). An no you can't guess it by looking at the output. Read the sourcecode. I don't even know, if it's possible with php. And if so, than more complicated and much longer sourcecode.

Thanks TomS. This is what I thought. Laughing
You said,
Quote:
Read the sourcecode.

Is there someplace (or post) where I can find some code where javascript and php are used together?
jeremyyak
The following will get the users ip address and write it into a javascript alert box.

Code:
<?php
//This gets the users ip address
$ip=$REMOTE_ADDR;
?>
<html>
<head>
<script type="text/javascript">
function disp_alert()
{
alert("Your ip address is:<?php echo $ip; ?>)
}
</script>
</head>
<body onLoad"disp_alert()">
</body>
</html>


~Jeremy~
snowboardalliance
Just keep in mind, php is server-side, so it's all done behind the scenes and you don't see the source as a user. The output is just plain text, so by outputting html and javascript, you output a webpage. Javascript is a client-side scripting language and all code is visible to the user. That might help.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.