Jump to content


PHP Help

  • Please log in to reply
1 reply to this topic

#1 TheVault


    Young Padawan

  • Members
  • Pip
  • 84 posts
  • Location:Locked Within A Vault

Posted 26 October 2006 - 03:06 PM

I'm taking a Java Programming class in school and I'm really enjoying it. I do notice that its much similar to php.

Well in java, when you ask user for information to be stored in a variable, the code is much like this:

public class ProgramName

public static void main(String[] args)

int fname, lname; //Variables. fname is First Name & lname is Last Name

System.out.println("Enter your first name"); //asking user for their first name
fname=Keyboard.readInt(); //getting information for their first name

System.out.println("Enter your last name"); //asking user for their last name
lname=Keyboard.readInt(); //getting informatino for their last name

System.out.println("Your name is" + fname + lname); //outputting their first and last name

In school, we have a file called Keyboard.java which we downloaded that allows user to enter as much information they desire and it gets stored within the variables I had specified.

Well I'm kinda looking for this same concept. In php, how would I make it where users type information and that information is stored within Variables or Strings so later on, I can display them or something. I really need to know this. I kinda understand PHP better thanks to this Java programming because they are much releated.

Edited by TheVault, 26 October 2006 - 03:08 PM.

#2 NGPixel


    Senior Programmer

  • P2L Staff
  • PipPipPipPip
  • 1,410 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design : Coding : Animation

Posted 26 October 2006 - 10:36 PM

You can't do that at all lol. PHP is server-side so it has no possible interactions with the user actions.

You will need to use Forms instead. The user type in a textbox the infos, then click the Submit button and PHP gets the data entered by the user.

I wouldn't say Java is that similar to PHP. Yes it has mostly the same syntax but definitly not interact with the user the same way.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users