Beginner seeking help

Hello Everybody

So I am brand new to php and the world of computer science in general. I was going through the tutorial at http://www.phphelp.com/tutorial/getting-started-with-php.php?page=3 and I’m pretty certain I am not seeing the correct results.

I have the code below saved in a folder on my desktop. The file is called Hello.html
[php]

Name: [/php]

The page asks the user for a name and when they hit submit I think the code on the new page is supposed to say “Hello frmName” (I’m assuming frmName is the name that was entered in the previous code above.
The code below is also saved in the same folder on my desktop and it’s called “hello-web.php”
[php]

Hello <?php echo($_POST["frmName"]); ?>!

[/php]

So all I say after the user clicks submit is “Hello !” and no name.

Thanks for all of your help!

Well, fjam, first you need to learn about PHP. You must understand that PHP is a SERVER-SIDE system.

Displaying a webpage is a three part system.

  1. HTML which can be displayed on any computer. It connects to a server and loads the page.
  2. PHP is a SERVER-SIDE language that creates a page using the HTML sent to it by the browser
    along with it’s own code which can also connect to databases.
  3. CLIENT-SIDE code inside a browser that displays the combined HTML and PHP-OUTPUT code.
    (This can also contain JAVASCRIPT for more programming effects.)

So, what you currently have is a webpage (locally stored.) , PHP code locally stored which can not run.

To fix this you need to move your hello-web.php code to a server or create your own server.
If you have a server available, upload both of your files to it and start with your main html page.
If you do not have access to a server, you can create one with this free setup. Please note that it may
involve a lot of questions. But, might help you.
http://www.apachefriends.org/en/xampp.html Good luck…

ErnieAlex,

Thank you so much for your reply. I had a feeling that not having a server was the issue, but I’m brand new to php and I didn’t understand the concepts fully. I downloaded the appache server but, I don’t know where to put the actual files or how to upload the files to the server. I have a xampp folder in my C drive and in the xampp folder there is a FileZilla ftp. That looked like the closest thing to a server to me and I dropped both of my files in there but still no results :frowning: . I guess my question is by downloading xampp do I have a virtual server? If, so where can I put my php/html files so I can start learning how to code? THANK YOU!!..Sorry for the rookie mistakes.

Nobody is a ROOKIE… I am learning things every day! Just different levels of knowledge… LOL

So, since I use a real server, I will install XAMPP on one of my systems to play with soon.

But, I did google this subject and found the following…

"put your folder website at C:\AppServ\www
and then test in url localhost/your folder website/ "

It seems that you put your website files, html and php into one folder named your website name in the appserv\www\yourwebsitefolder\ And, if you have more folder they go inside there. Why would you have more folders? Well, most web designers put all their images into a subfolder called “images”. This cleans up the file list a lot. But, you have to remember when you load an image in a page to add the src=\images\xyz.jpg to your pages code. To test your site, in your browser you type something like this…
localhost/yourwebsitefoldername/index.html or whatever your first page is called. I would creat a desktop link to the first file to make it easier to reach it.

Also, it seems that you can find a lot of info from the XAMPP site, or google or here of course!

Good luck…

You can also test locally by Using WAMP SERVER, or XAMP, or MAP (for Macs). Google it.

Once installed WAMP, for instance, there will be a wamp/www folder in your C:/ drive, or whatever drive you specified during installation.

Just Make sure you put your files inside your www folder and access your files from the browser as follow:

http://localhost/myproject/index.php where myproject is a folder inside www folder.

You can also place files loose in www, if you wish: http://localhost/idex.php

JJ-DR and ErnieAlex,

Thanks for your advice. Greatly appreciated and helped. I just figured out how to access the files. The link below is how accessed the files…“Website” is the folder where all of my html/php files are located and “hello%20-%20Copy.html” is the name of the file that has some php code in it and it calls another page with php code.

http://localhost/xampp/website/hello%20-%20Copy.html

Once again, thanks for you all of your help…greatly appreciated!

Great! Glad to hear you are into the PHP world…

Do not hesitate to SEARCH this site for answers to other questions or post them.

 Good luck with your PHP project...

Oh, also, if you need code samples you can check out PHP’s site at PHP.net

Hello,

I was trying to place another folder at the same location that I have the “Website” folder at but for some reason every time I go to it’s URL I get the following error message.

" Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
02/07/12 23:46:47
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1"

So my current location is “http://localhost/xampp/website/hello%20-%20Copy.html” (Basically the Website folder is in the xampp folder on my C drive.)

Why is this happening? Any ideas as to how I can solve it?

Thanks, sorry for the confusion!

Well, a 404 error means the page is not found. Either it does not exist or you spelled it wrong.

First, use Windows Explorer, just open a folder. Go to your current website.

This would be http://localhost/xampp/website/ In this folder you should see all your website pages.

To create a new folder in it, right-click and go NEW FOLDER and type a name. Careful of caps as you have to type them in if you are typing addresses.

SO your new folder would be: http://localhost/xampp/website/NEWFILENAME/ And, you can drop files there. So, if it was for images, http://localhost/xampp/website/images/ Does that help?

Oh, one more thing, you can create a shortcut to these folders onto your desktop and save some time!
(go to the shortcut, open the folder and double-click on a page to start it up. Faster than typing!)

Good luck…

Hi Ernie Alex,

I completely understand what you’re saying…I tried doing that before my last post but that didn’t work…It’s weird… if I add new files or if I delete files from the “Website” folder it doesn’t show when I go there through this url: http://localhost/xampp/website/ (this worked last week tho)

I almost feel like the url is pointing to an older timestamp on my computer…do you know what I mean? I feel like what’s on my machine is not being communicated to the server.

I noticed that you sometimes use spaces in your file names as in hello%20-%20Copy.html… that’s a huge NO NO!

The browser usually adds % to represent a space, and that’s how I know you used spaces.

Use dashes and underscores to separate words such as my_big-video.html or you can also used a combination of lowercase and uppercase characters as in myBigVideo.html

xamp’s default location is usually htdocs, though that might have changed. I use wamp, so i’m not sure :slight_smile: also make sure the server is online and the spelling and capitalization is correct. when dealing with urls, there’s a big difference between forum and Forum

Fjam,
You received documentation with Xampp or Wamp when you installed it. You should read it and it will help you with getting started. Also, the website that you got it from will explain a lot too. They have tutorials to help too. And, as I always say to EVERYONE: Google is your buddy, Google is your friend… LOL… I help a lot of people by just googling the answer for them. Ask it things like “Xampp where is the default folder”. I always use the app or program name first and then the question, gets better results.
And, if all those do not help please ask again in this post and one of us will respond. Good luck!

I use it a lot, specially when someone uses a function in some help that’s not built into php :wink:

but yea, you can copy and paste the error messages and do a search. won’t always give you the answer you’re looking for, but it should give you a hint as to what’s wrong :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service