Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
form not displaying, HELP!!!
Old 03-29-2008, 12:52 PM form not displaying, HELP!!!
jonathanadams's Avatar
Experienced Talker

Posts: 34
Name: Jonathan Adams
Trades: 0
My code is below, the form does not display!!!

PHP Code:
<html>
<head> <title>Adding a New User</title> </head>
<body>

<?php
    
    $firstname 
$_POST ['firstname'];
    
$lastname $_POST ['lastname'];
    
$username $_POST ['username'];
    
$password $_POST ['password'];
    
if( ( !
$firstname ) or ( !$lastname ) or ( !$username ) or ( !$password ) )

{
    
$form "<h2>Please enter all new user infromation</h2>";
    
$form.= "<form action=\"$self\" method=\"post\">";
    
$form.= "<input name=\"firstname\" type=\"text\" value=\"$firstname\">";
    
$form.= "<input name=\"lastname\" type=\"text\" value=\"$lasttname\">";
    
$form.= "<input name=\"username\" type=\"text\" value=\"$username\">";
    
$form.= "<input name=\"password\" type=\"text\" value=\"$password\">";
    
$form "</form>";
    echo( 
$form );
}
else
{
    
$conn = @mysql_connect "localhost""jonathanadams""bu88les""cms" )
    or die (
"<h2>Could not connect to MySQL</h2>");
    
$db = @mysql_select_db "users"$conn )
    or die (
"<h2>Could not select the database</h2>");
    
$sql "insert into users
    (firstname,lastname,username,password) values
    (\"
$firstname\",\"$lastname\",\"$username\",\"$password\") )";
    
$result = @mysql_query$sql$conn )
    or die (
"<h2>Could not exicute query</h2>");
    if( 
$result ) {echo( "<h2>New user $username added</h2>" ); }
}
?>

</body>
</html>
__________________

Please login or register to view this content. Registration is FREE
jonathanadams is offline
Reply With Quote
View Public Profile Visit jonathanadams's homepage!
 
 
Register now for full access!
Old 03-29-2008, 01:14 PM Re: form not displaying, HELP!!!
mork29's Avatar
Extreme Talker

Posts: 242
Name: Keith Yelnick
Trades: 0
Before you go any further with this. Please google for "SQL Injection". I think there is also a very informative sticky on this very board about the subject.
mork29 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to form not displaying, HELP!!!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.74693 seconds with 12 queries