PHP Register Form > Code erscheint auf dem Formular

Alles, was PHP betrifft, kann hier besprochen werden.

PHP Register Form > Code erscheint auf dem Formular

Postby ScienceGuy22 » 19. September 2010 22:13

Als ich in den Code-Typ
<? Php
echo "<h1> Anmeldung </ h1>";

Submit = $] $ _POST ['submit';

/ / Form data
$ FullName = $ _POST ['FullName'];
$ Username = $ _POST ['username'];
$ Password = $ _POST ['password'];
$ Repeatpassword = $ _POST ['repeatpassword'];


if ($ submit)
(

echo "$ username / $ password / $ repeatpassword / $ FullName";

)

?>

All das ist passiert, es zeigt die Kodierung an der Spitze meiner Form, als ich eine Vorschau in Firefox versuchen ... Ich habe diesen Code ganz oben auf der scrpt und vor dem <html> Tagg

why does it do this
?

Image
ScienceGuy22
 
Posts: 14
Joined: 28. August 2010 09:08

Re: PHP Register Form > Code erscheint auf dem Formular

Postby Altrea » 20. September 2010 04:56

ScienceGuy22 wrote:<? Php
echo "<h1> Anmeldung </ h1>";

Submit = $] $ _POST ['submit';

/ / Form data
$ FullName = $ _POST ['FullName'];
$ Username = $ _POST ['username'];
$ Password = $ _POST ['password'];
$ Repeatpassword = $ _POST ['repeatpassword'];


if ($ submit)
(

echo "$ username / $ password / $ repeatpassword / $ FullName";

)

?>

I don't believe, that this is your code. Whitespaces everywhere (after every $-Sign!?).
And what schould this line do:
Code: Select all
Submit = $] $ _POST ['submit';

And no word "Registration" like you can see in your Screenshot.

This way we can't help you. We can just guess, that it has something to do with:
- short_open_tags
- opening the file without a php-parser
--> wrong opening directly in your browser (what does your browser address line looks like if the file is on your screen?)
--> wrong file type (the file extension must be .php to let the server know, you have php code in your file)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6764
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: PHP Register Form > Code erscheint auf dem Formular

Postby Nobbie » 20. September 2010 08:38

"<? Php" is not a valid PHP Tag. It must be "<?php" instead.
Nobbie
 
Posts: 6921
Joined: 09. March 2008 13:04

Re: PHP Register Form > Code erscheint auf dem Formular

Postby ScienceGuy22 » 21. September 2010 00:25

This is my code

<?php
echo "<h1> Registration </h1>";

$submit = $_POST['submit'];

// form data
$fullname = $_POST['fullname'];
$username = $_POST['username'];

$password = $_POST['password'];
$repeatpassword = $_POST['repeatpassword'];


if ($submit)
{

echo "$username/$password/$repeatpassword/$fullname";

}

?>

The only reason it shows white spaces between it is because I put everything through google translator, in order to obtain the german version of my problem, and it made the spaces itself, and I didn't think to check it. =/

And so I am still having the same problem
ScienceGuy22
 
Posts: 14
Joined: 28. August 2010 09:08

Re: PHP Register Form > Code erscheint auf dem Formular

Postby Altrea » 21. September 2010 00:38

read my post again, especially the last 3 lines.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6764
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: PHP Register Form > Code erscheint auf dem Formular

Postby ScienceGuy22 » 21. September 2010 01:01

this is what it says:

file:///C:/Users/Sheiße/Desktop/LS/black/register.php

And what exactly is a PHP Parser?

I have MYSQL and APACHE Running on XAMPP FYI

On the Tutorial I am doing this off of:

http://www.youtube.com/watch?v=U1jFhFM4 ... re=channel

It's showing that they are testing it off of Localhost/

What am I doing wrong here?
ScienceGuy22
 
Posts: 14
Joined: 28. August 2010 09:08

Re: PHP Register Form > Code erscheint auf dem Formular

Postby Altrea » 21. September 2010 01:29

ScienceGuy22 wrote:file:///C:/Users/Sheiße/Desktop/LS/black/register.php

That is wrong. PHP is a server side script language. That means, php can only work through a php-parser. A php parser is a type of compiler and interpreter.

What you have to do:
1. save your php files inside the Webservers DocumentRoot (or a subfolder of that). Your DocumentRoot is the htdocs folder inside your xampp installation directory
2. Request your files with the http protocol => (e.g. http://localhost/ requests your DocumentRoot folder, http://localhost/file.php requests the file.php inside the DocumentRoot Folder, http://localhost/folder/file.php requests the file.php inside the folder in your DocumentRoot Path, and so on)

You can't open php files directly in your browser. That works with HTML but not PHP.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6764
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: PHP Register Form > Code erscheint auf dem Formular

Postby ScienceGuy22 » 22. September 2010 00:35

I have the file stored here in a subfolder of HTDOCS (I Made a subfolder because I noticed there was 1 index.html and 1 index.php in there by default and I didn't know where to put it.. so this is what it says now: file:///C:/xampp/htdocs/ls/register.php

I even tried:
http://localhost/xampp/htdocs/ls/register.php
but nothing came up

When doing this I still get the coding at the top of the preview page:
Registration "; $submit = $_POST['submit']; // form data $fullname = $_POST['fullname']; $username = $_POST['username']; $password = $_POST['password']; $repeatpassword = $_POST['repeatpassword']; if ($submit) { echo "$username/$password/$repeatpassword/$fullname"; } ?>

when I try preview in browser (from Dreamweaver cs3) I would get this message:

Image


and when I click YES it asks me to create a new directory (??)

Image

I have only been programming for the last 3 months (started from novice knowledge of html coding) So I greatly appreciate any help I can get from good people.

Remember - Good things happen to good people


Thanks/Danke Shoen

-Simon
ScienceGuy22
 
Posts: 14
Joined: 28. August 2010 09:08

Re: PHP Register Form > Code erscheint auf dem Formular

Postby Altrea » 22. September 2010 04:49

ScienceGuy22 wrote:I have the file stored here in a subfolder of HTDOCS

Thats good.

ScienceGuy22 wrote:.. so this is what it says now: file:///C:/xampp/htdocs/ls/register.php

Thats wrong again. file:/// is not the same protocol as http://.

ScienceGuy22 wrote:I even tried:
http://localhost/xampp/htdocs/ls/register.php
but nothing came up

Thats even wrong. localhost routes directly to your DocumentRoot (htdocs) folder, so you don't have to type in the folders to htdocs in the address bar. But you don't read my last post carefully enough to get this.

All the rest of your post is Dreamweaver specific. I can't teach you how to configure Dreamweaver the right way. Thats maybe a question for a Dreamweaver Board.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6764
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: PHP Register Form > Code erscheint auf dem Formular

Postby ScienceGuy22 » 22. September 2010 06:39

Are you sure it's okay if it's in a subfolder of htdocs?


Image

I get this ERROR:

Error 404
localhost
9/21/2010 10:40:01 PM
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

When I type in http://localhost/xampp/htdocs/ls/register.php
ScienceGuy22
 
Posts: 14
Joined: 28. August 2010 09:08

Re: PHP Register Form > Code erscheint auf dem Formular

Postby Altrea » 22. September 2010 07:16

ScienceGuy22 wrote:Are you sure it's okay if it's in a subfolder of htdocs?

No, i get my 900+ posts here with answering totally wrong things.

ScienceGuy22 wrote:I get this ERROR:

Error 404
localhost
9/21/2010 10:40:01 PM
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

When I type in http://localhost/xampp/htdocs/ls/register.php

Read my last post again
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6764
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: PHP Register Form > Code erscheint auf dem Formular

Postby ScienceGuy22 » 22. September 2010 09:50

ScienceGuy22
 
Posts: 14
Joined: 28. August 2010 09:08


Return to PHP

Who is online

Users browsing this forum: No registered users and 6 guests