RE: Simple PHP Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks everyone, it worked
-----Original Message-----
From: Ryan Jameson (USA) [mailto:RJameson@usa.ibs.org]
Sent: Thursday, February 13, 2003 4:14 PM
To: php-db@lists.php.net
Subject: RE:  Simple PHP Script


It's the good ole' register_globals feature...

You'll need to either turn register_globals on in your php.ini file or
access the variables from their respective arrays ($_SERVER,$_GET,$_POST)...
since your form method is post it will be: $_POST['vname'].

Make sense?

If you put this at the top of your page it will extract these all for you:

if (!empty($_SERVER))
  extract($_SERVER);
  
if (!empty($_GET)) {
extract($_GET);
} else if (!empty($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
}

if (!empty($_POST)) {
extract($_POST);
} else if (!empty($HTTP_POST_VARS)) {
extract($HTTP_POST_VARS);
}

........ 
<>< Ryan



-----Original Message-----
From: Poon, Kelvin (Infomart) [mailto:kpoon@infomart.ca]
Sent: Thursday, February 13, 2003 2:12 PM
To: 'php-db@lists.php.net'
Subject:  Simple PHP Script


Hi,

I am new to PHP and had just written a simple php script to get things
started.  I have the following code:


<html>
<body>
<?php
if($submit1) {
echo "hello $vname";
} else {
?>
<form action="thispage.php" method=post>
<table>
<tr><td>Input yourname</td><td><input type=text name=vname></td></tr>
<tr><td colspan=2><input type=submit name=submit1></td></tr>
</table>
</form>
<?php
}
?>
</body>
</html>

So this page is suppose to display a input box and a submit button and once
you enter ur name and press the button, it should show Hello [ur name] and
the input box at the bottom of it and the button below and the process
continue.

I tried running it and inputted some text and pressed the button, and the
Hello [ur name] didn't show up, it just display an input box and the submit
button.

Can someone please help me?

Thanks a lot

Kelvin

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux