|
 |
|
 |
08-26-2003, 09:40 AM
|
#1 (permalink)
|
|
Registered User
Join Date: Aug 2003
Location: SF
Posts: 45
|
Another newbie question.
ok, so i am trying to follow this stupid tutorial on the web until I get to the bookstore, and it really is'nt helping much. I was hoping somebody could tell me what I am doing wrong here. Here is my html then my PHP. Also any suggestions for a good book on php/mysql?
----------------------------------------------------------------------
html
----------------------------------------------------------------------
<html>
<head>
<title>welcome test</title>
<body>
<FORM ACTION="welcome.php" METHOD=POST>First Name: <INPUT TYPE=TEXT NAME="name"><INPUT TYPE=SUBMIT VALUE="GO"></FORM>
</body>
</html>
----------------------------------------------------------------------
php
----------------------------------------------------------------------
<html>
<head>
<title>Welcome test php doc</title>
</head>
<body>
<?php
if ( $name == "o" ) {
echo( "Welcome, mister O!" );
} else {
echo( "Welcome, $name!" );}
?>
</body>
</html>
|
|
|
08-26-2003, 09:47 AM
|
#2 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
|
same things as last time .. since you are too 'afraid' to turn off register_globals (  ), you must use either $_GET or $_POST before the variables you submit from a form.. depending on the method you send.
for this to work right, you will probably have to use $_POST['name'] to make it work.
it's cool to see your getting into it.. you should use the [php ] [/php ] and [code ] [/code ] tags when you post code. it makes it so much easier to read.
__________________
Mike
|
|
|
08-26-2003, 10:06 AM
|
#3 (permalink)
|
|
Registered User
Join Date: Aug 2003
Location: SF
Posts: 45
|
aaahhh. OK I think I get it now, you answered alot of other questions I had too! thanks
how do I use the code and PHP buttons? I tried to put the code in the dialog box that opens up but it did'nt let me paste it in there. Ill try to figure it out.
oh ya and  you too! 
|
|
|
08-26-2003, 10:40 AM
|
#4 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
|
try this:
test.php
PHP Code:
<html>
<body>
<?
// condition if no name is entered
if(!$_POST['name'])
{
echo "Please Enter Your Name Below.";
}
// if "o" is entered, greet O as MR.
elseif($_POST['name'] == "0")
{
echo "Hi Mr. O";
}
// this is how you greet everyone else
else
{
echo "wazzzzaaap $_POST['name']";
}
?>
<br><br>
<form action$_SERVER['PHP_SELF'] method=POST>
Name:
<input type=text name="name"><input type=submit value="Go">
</form>
</body>
</html>
i like using lowercase for html.
__________________
Mike
|
|
|
08-26-2003, 12:21 PM
|
#5 (permalink)
|
|
Registered User
Join Date: Aug 2003
Location: SF
Posts: 45
|
it worked, but I had to isolate the variables outside of the string, for the else statement, just like before. hmmmm...were you trying to test me? 
|
|
|
08-26-2003, 12:41 PM
|
#6 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
|
err ..uuuhhh .. yeah, .. it was a test haha
i actually thought about it, but didn't want to explain it to someone so green .. but i forgot i explained it before, and i forgot that those _POST type of variables only work isolated for you.
i pretty much isolate all my variables now a days.
__________________
Mike
|
|
|
08-26-2003, 01:57 PM
|
#7 (permalink)
|
|
LOAD "*",8,1
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
|
Quote:
Originally posted by sde
PHP Code:
// if "o" is entered, greet O as MR.
elseif($_POST['name'] == "0")
{
echo "Hi Mr. O";
}
|
o, 0, and O, huh? way to introduce subtle mistakes!
|
|
|
08-26-2003, 01:59 PM
|
#8 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
|
uhh .. it was another test .. i swear! 
__________________
Mike
|
|
|
08-26-2003, 02:07 PM
|
#9 (permalink)
|
|
Registered User
Join Date: Aug 2003
Location: SF
Posts: 45
|
on that note... how can I make accept o and O? I noticed it was case sensitve.
|
|
|
08-26-2003, 02:20 PM
|
#10 (permalink)
|
|
Registered User
Join Date: Aug 2003
Location: SF
Posts: 45
|
I found out one way of doing it, using "or".
|
|
|
08-26-2003, 03:03 PM
|
#11 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
|
so what sparked this interest in php?
__________________
Mike
|
|
|
08-26-2003, 03:55 PM
|
#12 (permalink)
|
|
Registered User
Join Date: Aug 2003
Location: SF
Posts: 45
|
I was just bored at work one day and decided I needed to learn something new. I just finished a class on html and saw a bunch of stuff about php and mysql, so I thought why not learn it. I work on a helpdesk, most of the users in my office are programmers, analysts, etc.(IT workers). So my job is real easy and I have a lot of free time.
|
|
|
08-26-2003, 04:09 PM
|
#13 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
|
heh, i made a php/mysql help desk program to log customers, products and issues. a support dept. of 20 uses it now =)
i'm working on a windows app version of it now though.
__________________
Mike
|
|
|
08-26-2003, 04:13 PM
|
#14 (permalink)
|
|
Registered User
Join Date: Aug 2003
Location: SF
Posts: 45
|
hmmm, the logging tool at my job sucks. Maybe after I get used to this stuff I can create something like too!
|
|
|
08-26-2003, 04:22 PM
|
#15 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
|
we were using intertrac before that .. a module for lotus notes. it was soooo slow. it took about 10 seconds in between screens. not to mention it wasn't very customizable.
the one i wrote has been running a little over a year now. we generate reports with crystal reports using an odbc driver, and then i just make some web reporting and searching tools also.
it's integrated into our online knowledge base. so the product specialists can create knowledge base entries, .. they submit them, and someone with supervisor rights can publish it to the web .. or send it back for fixing.
it has a built in messenging system, and the next module i'm building into it is for online support. it will be semi-automated and suggest knowledge base entries that might help based on a keyword search, but a human will read it just to make sure the right information is going out.
fun stuff
__________________
Mike
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -8. The time now is 04:20 AM.
|
Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
|
 |
|