Domestos
Jun 13 2005, 08:27 PM
Hi all - please help...
using <FORM> HTML tag for user input and need to get get data from it and
store in php variable...
<input type="text" name="user_name" size="18" maxlength="16"
class="input_left" tabindex="11" />
using the following to try and get user_name, but $user_name comes back
blank in both cases...
$user_name=$HTTP_POST_VARS['user_name'];
$user_name=$_POST['user_name'];
TIA
Tony
Jun 13 2005, 10:34 PM
Domestos wrote:
QUOTE |
Hi all - please help...
using <FORM> HTML tag for user input and need to get get data from it and store in php variable...
<input type="text" name="user_name" size="18" maxlength="16" class="input_left" tabindex="11" /
using the following to try and get user_name, but $user_name comes back blank in both cases...
$user_name=$HTTP_POST_VARS['user_name'];
$user_name=$_POST['user_name'];
|
What is the full <FORM> tag?
--
Tony Garcia
http://www.dslextreme.com/~tony23/
Domestos
Jun 14 2005, 07:48 PM
heres the html code...
<?php
$user_name=' ';
require_once('includes.php');
do_html_header('register');
?>
<form action="register_new.php" method="post" enctype="text/plain"
name="register">
<fieldset><legend>Personal Details</legend>
<p>
<label for="user_name" class="label_left"> Login Username :</label>
<input type="text" name="user_name" size="18" maxlength="16"
class="input_left" tabindex="11" />
</form>
<?php
?>
and here is the file register_new.php
<?php
require_once('includes.php');
//create short variable names
$user_name=$_POST['user_name'];
echo $user_name;
?>
And it leaves a blank screen !!!!
Geoff Berrow
Jun 14 2005, 09:39 PM
I noticed that Message-ID: <voHre.23276$[Email Removed]>
from Domestos contained the following:
QUOTE |
And it leaves a blank screen !!!!
|
Standard advice, strip code down to the shortest snippet that shows the
error.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Kimmo Laine
Jun 15 2005, 02:53 AM
"Domestos" <[Email Removed]> kirjoitti
viestiss:voHre.23276$[Email Removed]...
QUOTE |
heres the html code...
<?php $user_name=' '; require_once('includes.php'); do_html_header('register'); ? <form action="register_new.php" method="post" enctype="text/plain" name="register" <fieldset><legend>Personal Details</legend <p <label for="user_name" class="label_left"> Login Username :</label <input type="text" name="user_name" size="18" maxlength="16" class="input_left" tabindex="11" /
|
Dude! Where's My Submit button??
QUOTE |
</form <?php ?
and here is the file register_new.php
<?php require_once('includes.php'); //create short variable names $user_name=$_POST['user_name'];
echo $user_name;
?
|
Try debugging by making sure you get variables outside php in _some_ cases.
Easy code in other words.
Make page.php that you call with page.php?foo=bar
contets of said page:
<?php
var_dump($_GET);
var_dump($_POST);
var_dump($HTTP_GET_VARS);
var_dump($HTTP_POST_VARS);
var_dump($_REQUEST);
?>
['foo']=bar should appear at least in three arrays: request, get and
http_get_vars. If it doesn't, contact administrator.
Next add to said page.php the following code
<form method="POST">
<input type="submit" name="foo" value="bar">
</form>
Click the button bar. Again ['foo']=bar should appear at least in three
arrays: request, post and http_post_vars. If it doesn't, contact
administrator.
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
[Email Removed]
insekta
Jun 15 2005, 03:01 PM
hi all,
don't you need () around the $_POST?
as in .. $user_name = ($_POST['user_name']);
<snip>
QUOTE |
$user_name=$_POST['user_name'];
echo $user_name;
|
</snip>
just wondering...
p.j.
(i'm relatively new to all of this stuff too.)
Kimmo Laine
Jun 15 2005, 04:37 PM
"insekta" <[Email Removed]> kirjoitti
viestiss:42b055d8$0$11710$[Email Removed]...
QUOTE |
hi all,
don't you need () around the $_POST?
as in .. $user_name = ($_POST['user_name']);
|
No. Who ever gave you that idea?
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
[Email Removed]
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.