 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
06-02-2005, 02:06 AM
|
#21 (permalink)
|
|
The Acquainted
Join Date: May 2005
Posts: 106
Thanks: 0
|
wait,
this line
<input type="text" FirstName="FirstName">
should be
<input type="text" name="FirstName">
see the difference, same with everyline. name is kind of reserved word and it is to be used as it is. the value inside quotes and after = is the actual value
Database:
NO,
to select database you have to do this
PHP Code:
$con = @mysql_connect("localhost", "dbuser", "dbpassword");
if($con)
{
if(@mysql_select_db('database_name'))
{
$query = "insert into dbname.dbtable (FirstName, LastName, Email, Phone, Address, City, State, Zip, Username, Password, LastLogin)".
"values('$FirstName', '$LastName', '$Email', '$Phone', '$Address', '$City', '$State', '$Zip', '$Username', '$Password', '$LastLogin')";
$result = mysql_query($query);
if ($result)
{
echo <<<EOT
Thank You
Your signup is appreciated.
EOT;
}
else
{
echo mysql_error();
}
}
else
{
echo mysql_error();
}
mysql_close($con);
}
else
{
echo 'Could not connect to database<br>';
}
again check there SHOULD BE NOTHING AFTER EOT;(not even space)
__________________
---------------------------
Errors = Improved Programming.
Portfolio
|
|
|
06-02-2005, 02:52 AM
|
#22 (permalink)
|
|
The Wanderer
Join Date: Jun 2005
Posts: 13
Thanks: 0
|
Ok so I kinda get the <input type="text" FirstName="FirstName">
should be
<input type="text" name="FirstName">
Does that mean <input type="text" name="LastName"> is ok? at what point do you NOT use name?
----- ERROR START -----
Parse error: parse error, unexpected $ in /XXXX/XXXXXXXX/public_html/signup/signup.php on line 42
----- ERROR END ------
Line 42 is the last line in the script ( ?> ) GRRRR back to square one it looks like, hehe
Here's my current code:
PHP Code:
<?php
error_reporting(E_ALL);
$FirstName = (isset($_GET["FirstName"]))?mysql_escape_string($_GET["FirstName"]):'';//use this function on all the input before storing it in database
$LastName = (isset($_GET["LastName"]))?mysql_escape_string($_GET["LastName"]):'';
$Email = (isset($_GET["Email"]))?mysql_escape_string($_GET["Email"]):'';
$Phone = (isset($_GET["Phone"]))?mysql_escape_string($_GET["Phone"]):'';
$Address = (isset($_GET["Address"]))?mysql_escape_string($_GET["Address"]):'';
$City = (isset($_GET["City"]))?mysql_escape_string($_GET["City"]):'';
$State = (isset($_GET["State"]))?mysql_escape_string($_GET["State"]):'';
$Zip = (isset($_GET["Zip"]))?mysql_escape_string($_GET["Zip"]):'';
$Username = (isset($_GET["Username"]))?mysql_escape_string($_GET["Username"]):'';
$Password = (isset($_GET["Password"]))?mysql_escape_string($_GET["Password"]):'';
$LastLogin = date("Y-m-d");
print "FirstName is $FirstName<br>\n";
print "Email is $Email<br>\n";
$con = @mysql_connect("localhost", "cashflow_dbuser", "dbpwd");
if($con)
{
if(@mysql_select_db('cashflow_members'))
{
$query = "insert into cashflow_members.client (FirstName, LastName, Email, Phone, Address, City, State, Zip, Username, Password, LastLogin)".
"values('$FirstName', '$LastName', '$Email', '$Phone', '$Address', '$City', '$State', '$Zip', '$Username', '$Password', '$LastLogin')";
$result = mysql_query($query);
if ($result)
{
echo <<<EOT
Thank You
Your signup is appreciated.
EOT;
}
else
{
echo mysql_error();
}
mysql_close($con);
}
else
{
echo 'Could not connect to database<br>';
}
?>
|
|
|
|
06-02-2005, 02:54 AM
|
#23 (permalink)
|
|
The Acquainted
Join Date: May 2005
Posts: 106
Thanks: 0
|
ALL THE TIME, you HAVE to use name.
value can be anything. by value i mean everything after =
all fields in a form must have a name.
__________________
---------------------------
Errors = Improved Programming.
Portfolio
|
|
|
06-02-2005, 03:06 AM
|
#24 (permalink)
|
|
The Wanderer
Join Date: Jun 2005
Posts: 13
Thanks: 0
|
Quote:
|
Originally Posted by jaswinder_rana
ALL THE TIME, you HAVE to use name.
value can be anything. by value i mean everything after =
all fields in a form must have a name.
|
Gotcha...fixed that. See the error I'm still getting ( previous post ) :confused:
|
|
|
|
06-02-2005, 03:09 AM
|
#25 (permalink)
|
|
The Acquainted
Join Date: May 2005
Posts: 106
Thanks: 0
|
again did you check this part
[qutoe]
echo <<<EOT
Thank You
Your signup is appreciated.
EOT;
}
[/quote]
there should be nothing after EOT;
NOTE: after getting an answer, if you have more question then just ask it.
DO NOT modify your old post(to add new stuff), as it is difficult to notice sometimes, becuase user thinks (like me), he alrady read that part.
it was by accident that i was checkinf "WHO is active" and i saw you modifying the post. so next time jsut post your new question
__________________
---------------------------
Errors = Improved Programming.
Portfolio
|
|
|
06-02-2005, 03:13 AM
|
#26 (permalink)
|
|
The Wanderer
Join Date: Jun 2005
Posts: 13
Thanks: 0
|
Yeah I believe the way I have the code now is what your wanting me to have. Yeah I understand about the posting of new questions, some peeps don't like threads lasting 100 posts so they want you to modify your lastpost so I figured I'd try my luck, but I totally understand where your coming from. I will keep that in mind :)
I don't know why it makes it look like that } is after the EOT; cause it's on the next line down. hmmmmm
|
|
|
|
06-02-2005, 03:08 PM
|
#27 (permalink)
|
|
The Wanderer
Join Date: Jun 2005
Location: London
Posts: 7
Thanks: 0
|
WTF is EOT ???
|
|
|
|
06-02-2005, 03:16 PM
|
#28 (permalink)
|
|
The Acquainted
Join Date: May 2005
Posts: 106
Thanks: 0
|
EOT is NOTHING. you can use SoftCloud instead of EOT
all it does is
PHP Code:
echo <<<SoftCloud
Will print everything here.
No matter how long or length.
Don't have to worry about escaping quotes ' "
SoftCloud;
To find it on internet, its called HEREDOC
First rule :: starting and ending name(whatever) should be SAME
Second:: Nothing should be after <<<SoftCloud (not even space)
Third:: which i myself was not aware of, nothing should be after ending SoftCloud; (not even space)
hope that helps
__________________
---------------------------
Errors = Improved Programming.
Portfolio
|
|
|
06-02-2005, 06:12 PM
|
#29 (permalink)
|
|
The Wanderer
Join Date: Jun 2005
Posts: 13
Thanks: 0
|
Ok I'll look at the source again to make sure....thx again for EVERYONE'S help
Should it be "print" instead of "echo"? I'm pretty sure they're both the same function right?
|
|
|
|
06-02-2005, 06:16 PM
|
#30 (permalink)
|
|
The Acquainted
Join Date: May 2005
Posts: 106
Thanks: 0
|
__________________
---------------------------
Errors = Improved Programming.
Portfolio
|
|
|
06-02-2005, 11:44 PM
|
#31 (permalink)
|
|
The Wanderer
Join Date: Jun 2005
Posts: 13
Thanks: 0
|
Thanks for the link, lots of good but confusing information there. I am at such a stand still right now....argh...I guess I'll just keep plugging away at it. I've been messing with this code all day trying tons of different things and no luck yet. :(
|
|
|
|
06-03-2005, 06:26 AM
|
#32 (permalink)
|
|
The Wanderer
Join Date: Jun 2005
Location: London
Posts: 7
Thanks: 0
|
Quote:
|
Originally Posted by jaswinder_rana
EOT is NOTHING. you can use SoftCloud instead of EOT
all it does is
PHP Code:
echo <<<SoftCloud
Will print everything here.
No matter how long or length.
Don't have to worry about escaping quotes ' "
SoftCloud;
To find it on internet, its called HEREDOC
First rule :: starting and ending name(whatever) should be SAME
Second:: Nothing should be after <<<SoftCloud (not even space)
Third:: which i myself was not aware of, nothing should be after ending SoftCloud; (not even space)
hope that helps
|
Ahhhh i get ya :)
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| 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
|
|
|
|