473,669 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting data out of <FORM> in php variable

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_le ft" tabindex="11" />

using the following to try and get user_name, but $user_name comes back
blank...

$user_name=$HTT P_POST_VARS['user_name'];


Jul 17 '05 #1
5 1888
On Mon, 13 Jun 2005 20:40:12 GMT, "Domestos" <ne*******@mind .net> wrote:
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_l eft" tabindex="11" />

using the following to try and get user_name, but $user_name comes back
blank...

$user_name=$HT TP_POST_VARS['user_name'];


Don't multipost. Post a minimal runnable script that demonstrates your
problem.

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
Try using $_POST['whatever']

Jul 17 '05 #3
Domestos (ne*******@mind .net) decided we needed to hear...
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_le ft" tabindex="11" />

using the following to try and get user_name, but $user_name comes back
blank...

$user_name=$HTT P_POST_VARS['user_name'];


What is the method attribute set to in your form tag? It should be set
to 'post' and defaults to 'get' if you don't specify it.

As an aside you should really be using $_POST instead of
$HTTP_POST_VARS which is deprecated.
--
Dave <da**@REMOVEbun dook.com>
(Remove REMOVE for email address)
Jul 17 '05 #4
heres the html code...

<?php
$user_name=' ';
require_once('i ncludes.php');
do_html_header( 'register');
?>
<form action="registe r_new.php" method="post" enctype="text/plain"
name="register" >
<fieldset><lege nd>Personal Details</legend>
<p>
<label for="user_name" class="label_le ft"> Login Username :</label>
<input type="text" name="user_name " size="18" maxlength="16"
class="input_le ft" tabindex="11" />
</form>
<?php
?>
and here is the file register_new.ph p
<?php
require_once('i ncludes.php');
//create short variable names
$user_name=$_PO ST['user_name'];

echo $user_name;

?>
And it leaves a blank screen !!!!
Jul 17 '05 #5


Domestos wrote:
heres the html code...

<?php
$user_name=' ';
require_once('i ncludes.php');
do_html_header( 'register');
?>
<form action="registe r_new.php" method="post" enctype="text/plain"
name="register" >
<fieldset><lege nd>Personal Details</legend>
<p>
<label for="user_name" class="label_le ft"> Login Username :</label>
<input type="text" name="user_name " size="18" maxlength="16"
class="input_le ft" tabindex="11" />
</form>
<?php
?>
and here is the file register_new.ph p
<?php
require_once('i ncludes.php');
//create short variable names
$user_name=$_PO ST['user_name'];

echo $user_name;

?>
And it leaves a blank screen !!!!


What happens if you remove the 'enctype="text/plain"' from your <form>?

If you change your register_new.ph p to

<?php
echo '<pre>';print_r ($_POST);echo '</pre>';
?>

What displays on the screen?

Ken

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12917
by: Ben | last post by:
Here's my form: <form name="aForm" method='post'> <input type=file name=file1 onkeypress='KeyPress()'><br> <a id='attachMoreLink' href='javascript:AddFileInput()">Attach More Files </a> <input type=submit value='Done'> </form>
4
2530
by: Howard Jess | last post by:
In Opera 8.01 (Linux; Build 1204) and in Opera 7.54 (Windows XP; Build 3865), my form disappears from the HTML markup (below). To summarize: 1) In a <script> block in the <head> I create a form element (part of object/feature/bug detection). 2) There's a <form> element defined in the <body>, with the id 'theForm'. 3) The onload function tries to access that form, and also counts the total number of forms in the document. It fails to...
10
8936
by: Phlip | last post by:
HTMListas: (Apologies for I can't Google for this - too many common words.) I have a <form> tag. It thinks I want a <p> break before and after the form. I don't. (My forms are sneaky and inline.) How do I avoid paragraph breaks around a <form> tag?
6
3869
by: snacktime | last post by:
I've searched and searched and have not found a solution to suppress the margin on form or href tags so that there is no space before or after the tag. The only way I have found to do this is to place the tags one after another without any spaces between them. For example, a space gets rendered between these two href's when displayed in firefox or IE. <a href="#"><img border="0" height="10" src="test.gif" width="10" /></a>
4
3713
by: rob c | last post by:
This is a minor thing and only appears in IE (so far), but I'd like to know to correct it (if possible). Whenever I use a form on a webpage, Explorer always leaves a blank line following the </form> tag but Mozilla doesn't. Is there a way to supress the blank line? Thanks Rob www.rcp.ca
12
4563
by: David Thielen | last post by:
Hi; I have my <form> in the master page because the master page includes the menu for all pages. But I would like to set the default button and control to place the caret in for each page. Is there a way to do this? (My understanding is this has to be done in the form tag.) -- thanks - dave david_at_windward_dot_net
19
2138
by: Coward 9 | last post by:
HI, I saw in an example hello.aspx, there is a <form tagbeing used like <form runat="server> I search all html tag references and could NOT find "runat" attributes for <formtag. which reference should I use in order to find that?
5
13853
by: shotokan99 | last post by:
for instance i do have this element but i dont have a <form>: <input type="Text" name="myname" id="myname" size="30"...> then i have this link: echo'<a href="mypage.php?name='.$myname.'...>Save</a>'; i want that $myname will the value of myname textbox. something like this: $myname= <the value of the textbox>
10
14153
by: neverquit | last post by:
hi , Iam Nagesh,Begineer in using Ajax,well i have been using ajax in application, i have faced a problem while placing the responseTEXT into the <div> tag positioned inside the <form> tag iam able to get the response in the <div> tag in mozilla (im takingthe HTML response), <script> function confirm() { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null)
0
8895
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8809
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2797
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.