LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-07-2004, 06:24 AM   #1
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Rep: Reputation: 30
PHP not working correctly


Hey all

I'm working on PHP at the moment and am trying to do a form.
I've got a simple one as a test but it doesn't show the typed data at all...

Code:
 <HTML>
  <FORM>
    Please type your name here:<BR>
    <INPUT type=text name=username><BR><BR>
    <INPUT type=submit value="Submit Data">
  </FORM>
<BR><BR>
You typed:
                                                                                              
<?php
  echo($username);
?>
                                                                                              
  </HTML>
This is a straightforward script - I can't understand whats wrong with it...
 
Old 07-07-2004, 06:33 AM   #2
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Original Poster
Rep: Reputation: 30
Just tried it with register_globals turned on and it worked - hwo can I get around this (i've heard that register_globals is a security issue.
 
Old 07-07-2004, 06:47 AM   #3
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Original Poster
Rep: Reputation: 30
Forget that one, used <FORM METHOD=POST> and got the variable using echo $HTTP_POST_VARS['username']; and it worked fine
 
Old 07-07-2004, 12:22 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,858

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
$HTTP_POST_VARS['username'] is the old way and is depreciated, use :
$_POST["username"] instead
 
Old 07-07-2004, 02:32 PM   #5
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Original Poster
Rep: Reputation: 30
Yeah I had found that too - I just forgot to post it

Thanks keefaz...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php will NOT work correctly :( arichardson Fedora 8 11-18-2005 07:28 AM
php will NOT work correctly :( arichardson Fedora 3 11-17-2005 03:10 PM
PhP not working correctly in Suse 9.3 webwolf70 SUSE / openSUSE 14 10-29-2005 09:33 AM
Apache-ssl not correctly parsing php files jme Linux - Software 2 05-03-2005 12:04 PM
Crypt in PHP and RH8 not working correctly. sschueller Linux - Software 0 03-06-2003 05:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration