Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-26-2003, 09:40 AM   #1 (permalink)
Odoggy5
Registered User
 
Odoggy5's Avatar
 
Join Date: Aug 2003
Location: SF
Posts: 45
Odoggy5 is on a distinguished road
Send a message via AIM to Odoggy5
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>
Odoggy5 is offline   Reply With Quote
Old 08-26-2003, 09:47 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
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
sde is offline   Reply With Quote
Old 08-26-2003, 10:06 AM   #3 (permalink)
Odoggy5
Registered User
 
Odoggy5's Avatar
 
Join Date: Aug 2003
Location: SF
Posts: 45
Odoggy5 is on a distinguished road
Send a message via AIM to Odoggy5
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!
Odoggy5 is offline   Reply With Quote
Old 08-26-2003, 10:40 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
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
sde is offline   Reply With Quote
Old 08-26-2003, 12:21 PM   #5 (permalink)
Odoggy5
Registered User
 
Odoggy5's Avatar
 
Join Date: Aug 2003
Location: SF
Posts: 45
Odoggy5 is on a distinguished road
Send a message via AIM to Odoggy5
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?
Odoggy5 is offline   Reply With Quote
Old 08-26-2003, 12:41 PM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
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
sde is offline   Reply With Quote
Old 08-26-2003, 01:57 PM   #7 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
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!
joe_bruin is offline   Reply With Quote
Old 08-26-2003, 01:59 PM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
uhh .. it was another test .. i swear!
__________________
Mike
sde is offline   Reply With Quote
Old 08-26-2003, 02:07 PM   #9 (permalink)
Odoggy5
Registered User
 
Odoggy5's Avatar
 
Join Date: Aug 2003
Location: SF
Posts: 45
Odoggy5 is on a distinguished road
Send a message via AIM to Odoggy5
on that note... how can I make accept o and O? I noticed it was case sensitve.
Odoggy5 is offline   Reply With Quote
Old 08-26-2003, 02:20 PM   #10 (permalink)
Odoggy5
Registered User
 
Odoggy5's Avatar
 
Join Date: Aug 2003
Location: SF
Posts: 45
Odoggy5 is on a distinguished road
Send a message via AIM to Odoggy5
I found out one way of doing it, using "or".
Odoggy5 is offline   Reply With Quote
Old 08-26-2003, 03:03 PM   #11 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
so what sparked this interest in php?
__________________
Mike
sde is offline   Reply With Quote
Old 08-26-2003, 03:55 PM   #12 (permalink)
Odoggy5
Registered User
 
Odoggy5's Avatar
 
Join Date: Aug 2003
Location: SF
Posts: 45
Odoggy5 is on a distinguished road
Send a message via AIM to Odoggy5
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.
Odoggy5 is offline   Reply With Quote
Old 08-26-2003, 04:09 PM   #13 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
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
sde is offline   Reply With Quote
Old 08-26-2003, 04:13 PM   #14 (permalink)
Odoggy5
Registered User
 
Odoggy5's Avatar
 
Join Date: Aug 2003
Location: SF
Posts: 45
Odoggy5 is on a distinguished road
Send a message via AIM to Odoggy5
hmmm, the logging tool at my job sucks. Maybe after I get used to this stuff I can create something like too!
Odoggy5 is offline   Reply With Quote
Old 08-26-2003, 04:22 PM   #15 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
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
sde is offline   Reply With Quote
Reply

Bookmarks

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
DB Design Question Part II sde Program Design and Methods 10 09-02-2008 11:37 AM
Hello! Please forgive newbie question jimmyoctane PHP 4 09-13-2004 06:33 AM
Would you mind if there were small flash elements at code newbie? sde Lounge 10 05-29-2004 09:05 PM
Newbie question. p0etsou1 Standard C, C++ 9 06-24-2003 07:47 AM
Newbie Site ? DesertWolf Java 2 12-05-2002 12:38 PM


All times are GMT -8. The time now is 04:20 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting