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
Need Help With A Coding Problem!
Old 08-06-2008, 07:52 AM Need Help With A Coding Problem!
Skilled Talker

Posts: 65
Trades: 0
Hey

I'm not sure which board this would go under, but i have a coding problem.

I want to add a "add your own tips" to my site.

I have a code, but i don't know really what to do with it, what databases to make, fields, etc.

HELP PLEASE
__________________

Please login or register to view this content. Registration is FREE
Sycrohix is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-06-2008, 08:37 AM Re: Need Help With A Coding Problem!
andrei155's Avatar
CEO of BLD Hosting

Posts: 1,514
Name: Andrei
Location: Canada
Trades: 6
You've given us very little information, and I don't think anyone here can read your mind. Why don't you start by linking us to the script you have, and maybe the website you want it to appear on.
__________________
No Overselling Guarantee
Now Includes a Free Domain
BLD Hosting -
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
andrei155 is offline
Reply With Quote
View Public Profile Visit andrei155's homepage!
 
Old 08-06-2008, 08:53 AM Re: Need Help With A Coding Problem!
Skilled Talker

Posts: 65
Trades: 0
haha, sorry.

The script a friend wrote for me;

PHP Code:
<?php
mysql_connect
("host""username""password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
function 
silence($string
{
        
$string htmlspecialchars$stringENT_QUOTES );
        if( 
get_magic_quotes_gpc(   ) ) {
 
            
$string stripslashes$string );
 
        }                
        
$string mysql_real_escape_string$string );
 
    return 
$string;  

 
if(!
$_POST["Submit"]) {
    echo 
"<form action=\"\" method=\"post\">
    <input type=\"text\" name="
tipsAuthor" />
    <input type=\"text\" name=\"tips\" />
    <input type=\"submit\" name=\"Submit\" />
    </form>"
;
 
}
else {
 
    
$clean["author"] = silence($_POST["tipsAuthor"]);
    
$clean["tip"] = silence($_POST["tips"]);
 
    
mysql_query("INSERT INTO tips (author, tip) VALUES('$clean["author"]', '$clean["tip"]' ) ") or die(mysql_error());  
}
?>
1) Would this script just go on the webpage?

He told me to make a database and 2 fields; author and tips, which i did, i got this;

This is what it looks like on the actual webpage;

This is what the database and fields look like;


The site page that it will go on is; http://www.get-rid-of-blackheads.com...Submitted.html

I hope that is enough information and thanks for any help!
__________________

Please login or register to view this content. Registration is FREE
Sycrohix is offline
Reply With Quote
View Public Profile
 
Old 08-06-2008, 09:20 AM Re: Need Help With A Coding Problem!
vn5ltr's Avatar
Skilled Talker

Posts: 93
Location: Melbourne, Australia
Trades: 0
PHP Code:
...
if(!
$_POST["Submit"]) {
    echo 
"<form action=\"\" method=\"post\">
    <input type=\"text\" name="
tipsAuthor" />
    <input type=\"text\" name=\"tips\" />
    <input type=\"submit\" name=\"Submit\" />
    </form>"
;
 
}
else {
 
    
$author silence($_POST["tipsAuthor"]);
    
$tip silence($_POST["tips"]);
 
    
mysql_query("INSERT INTO tips (author, tip) VALUES('$author', '$tip' ) ") or die(mysql_error());  
}
?> 
That should do it.
vn5ltr is offline
Reply With Quote
View Public Profile
 
Old 08-06-2008, 10:24 AM Re: Need Help With A Coding Problem!
Skilled Talker

Posts: 65
Trades: 0
Nope, still not working.

www.get-rid-of-blackheads.com/user-submitted.html
__________________

Please login or register to view this content. Registration is FREE
Sycrohix is offline
Reply With Quote
View Public Profile
 
Old 08-06-2008, 05:51 PM Re: Need Help With A Coding Problem!
Skilled Talker

Posts: 65
Trades: 0
Help?
__________________

Please login or register to view this content. Registration is FREE
Sycrohix is offline
Reply With Quote
View Public Profile
 
Old 08-07-2008, 08:18 AM Re: Need Help With A Coding Problem!
vn5ltr's Avatar
Skilled Talker

Posts: 93
Location: Melbourne, Australia
Trades: 0
What error are you getting?
vn5ltr is offline
Reply With Quote
View Public Profile
 
Old 08-07-2008, 08:51 AM Re: Need Help With A Coding Problem!
Skilled Talker

Posts: 65
Trades: 0

... if(!$_POST["Submit"]) { echo " "; } else { $author = silence($_POST["tipsAuthor"]); $tip = silence($_POST["tips"]); mysql_query("INSERT INTO tips (author, tip) VALUES('$author', '$tip' ) ") or die(mysql_error()); } ?>
__________________

Please login or register to view this content. Registration is FREE
Sycrohix is offline
Reply With Quote
View Public Profile
 
Old 08-07-2008, 08:59 AM Re: Need Help With A Coding Problem!
vn5ltr's Avatar
Skilled Talker

Posts: 93
Location: Melbourne, Australia
Trades: 0
PHP Code:
...
if(!
$_POST["Submit"]) {
    echo 
"<form method=\"post\">
    <input type=\"text\" name=\"tipsAuthor\" />
    <input type=\"text\" name=\"tips\" />
    <input type=\"submit\" name=\"Submit\" />
    </form>"
;
 
}
else {
 
    
$author silence($_POST["tipsAuthor"]);
    
$tip silence($_POST["tips"]);
 
    
mysql_query("INSERT INTO tips (author, tip) VALUES('$author', '$tip' ) ") or die(mysql_error());  
}
?> 
Try that.
vn5ltr is offline
Reply With Quote
View Public Profile
 
Old 08-07-2008, 11:58 AM Re: Need Help With A Coding Problem!
Skilled Talker

Posts: 85
Name: Ilyes Rhouma
Trades: 0
Are you sure your page is in .php extension ?
I think that the mesage that appears near the text boxes is because php is disabled.

Last edited by Ilyes; 08-07-2008 at 12:03 PM..
Ilyes is offline
Reply With Quote
View Public Profile Visit Ilyes's homepage!
 
Old 08-07-2008, 12:30 PM Re: Need Help With A Coding Problem!
Skilled Talker

Posts: 65
Trades: 0
THATS PROBABLY IT! Any ideas on how to enable it?
__________________

Please login or register to view this content. Registration is FREE
Sycrohix is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need Help With A Coding Problem!
 

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.51800 seconds with 12 queries