[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 07-03-2006, 11:33 AM   #1 (permalink)
Senior Member
 
Join Date: Oct 2003
Location: Winnipeg, Canada
Posts: 3,472
5.31 NP$ (Donate)

killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold


Getting information from a field

How do i get information from a field and then add it to an if statement?

I have:

PHP Code:
<?
if($check==yes){
echo
'OK';
}
else {
echo
'NO';
}
?>

<form name="searchform" method="post" action="check.php">
<input type="text" name="check" id="check" value="<? $check ?>" size="25">
<input type="hidden" name="action" value="check">
<input type="submit" name"submit" value="Check">
</form>
Im going to end up searching a database and if the information thats entered is found, they it will say its found, if not it would say its not found.



Nvm, i got it.

Last edited by killaklown; 07-03-2006 at 11:43 AM.
killaklown is offline  
Old 07-05-2006, 01:01 PM   #2 (permalink)
NamePros Regular
 
monaco's Avatar
 
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 695
314.80 NP$ (Donate)

monaco will become famous soon enough


You need to get the variable first via $_POST['name'] access semantics. Nobody in their right mind leaves register_globals on anymore.

For example, to check for a flag called "foo", my php would do this:
Code:
$flag = $_POST['foo'];
if( isset($flag) ) {
  echo "way to go smartguy, you typed \"$flag\".";
}
and my html for bit would look like:
Code:
<input type="text" name="flag" />
Now, if someone were to set the flag by typing something in there, it would execute, otherwise not.
__________________
My Website | My Blog
monaco is offline  
Closed Thread


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

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 06:59 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85