Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 21st, 2008, 11:23 PM   #1
pourinitup
Programmer
 
Join Date: Jul 2008
Posts: 51
Rep Power: 1 pourinitup is on a distinguished road
need help getting value from textbox

ok i put a textbox on my site and im trying to get the value from it when it can log when a user uploads

my html code for the textbox looks like this <input type="text" name="name" id="name" />

and the php for what i added looks like this
$Name = $_GET['name']; i used get because when i used POST it would bypass the null testing and just upload null or not
but then i added this to test null

if ($Name === NULL)
{
print ("$Name");
die ("You need to enter your name if you want credit for the upload.");
}

this made it so even if there was a name in the textbox it didnt read it
im completely stumped btw if you havent noticed im completely new to php
pourinitup is offline   Reply With Quote
Old Jul 22nd, 2008, 1:48 AM   #2
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Re: need help getting value from textbox

You were fine using $_POST. However, what you need to keep in mind is that when the value is submitted. An empty string is still a string. If you want to test for an empty string that was passed using $_POST then you could do something like:

if(strlen(trim($_POST['name'])) == 0)

In that case it says if the string is of length 0 then it's no good. The trim function removes all whitespace characters from the left and right side of a string.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Jul 22nd, 2008, 11:05 AM   #3
pourinitup
Programmer
 
Join Date: Jul 2008
Posts: 51
Rep Power: 1 pourinitup is on a distinguished road
Re: need help getting value from textbox

ill give that a try
pourinitup is offline   Reply With Quote
Old Jul 22nd, 2008, 12:16 PM   #4
pourinitup
Programmer
 
Join Date: Jul 2008
Posts: 51
Rep Power: 1 pourinitup is on a distinguished road
Re: need help getting value from textbox

it worked
thanks
pourinitup is offline   Reply With Quote
Old Jul 23rd, 2008, 2:50 PM   #5
pourinitup
Programmer
 
Join Date: Jul 2008
Posts: 51
Rep Power: 1 pourinitup is on a distinguished road
Re: need help getting value from textbox

hm now it wont actually upload and i didnt touch any of that code so im completely stumped...it says it was successfully uploaded but when i check my ftp nothing is there
any ideas?
pourinitup is offline   Reply With Quote
Old Jul 24th, 2008, 1:27 PM   #6
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: need help getting value from textbox

You may want to show us the upload code. We cannot help you debug if we cannot see it.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 24th, 2008, 8:23 PM   #7
pourinitup
Programmer
 
Join Date: Jul 2008
Posts: 51
Rep Power: 1 pourinitup is on a distinguished road
Re: need help getting value from textbox

well....for some reason it just started working outta nowhere but thanks for all the help guys
pourinitup is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
textbox in datalist ktsirig ASP.NET 0 Dec 14th, 2007 10:38 AM
Inserting text into a textbox 357mag C# 8 May 19th, 2007 7:35 PM
Winapi get textbox jayme C++ 6 Jan 16th, 2006 7:02 PM
Problems with Rich Textbox. mikaoj Visual Basic 3 Sep 7th, 2005 2:12 PM
Concatinating values from drop-down into textbox crmpicco JavaScript and Client-Side Browser Scripting 1 Jul 1st, 2005 7:18 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:05 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC