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
Problems getting variable values - very strange
Old 06-18-2005, 08:27 PM Problems getting variable values - very strange
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
I am writing a basic script which allows users to submit tutorials to a mysql database but Im having some trouble with it but its really weird...

Heres what Ive got:

PHP Code:
$category $_POST['category'];
$title $_POST['title'];
$caption $_POST['caption'];
$content $_POST['content'];
$author $_POST['author'];
$email $_POST['email'];


echo 
"$_POST['title']";
$query "INSERT INTO `article_art` ( `id` , `category` , `active` , `name` , `caption` , `content` , `author`) VALUES ('', '$category', '$active', '$title', '$caption', '$content', '$author');";
mysql_query($query) or die ("dead"); 
This is submitted to via a HTML form where all the input boxes have been named as category, title, caption, content, author and email.

The problem is that when the form is submitted the variables are not available in the script therefore it doesnt add into the database properly.

Now the strange thing is that I have created this script locally on my computer and it worked fine but when i now tried it live it doesnt want to work.

I just cant figure it out... Is there something Im doing wrong?

Thanks
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
 
Register now for full access!
Old 06-18-2005, 08:45 PM
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
Please post the form code as well. It's handy to see how the vars are being posted to the sql action. Also, upload a script to your local and live servers that does a phpinfo. Run the phpinfo scripts and compare the settings for both environments. Your answer could very well be revealed by the different php ini settings.
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Old 06-18-2005, 08:52 PM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
On the ..or die(" part of the query, change it to

PHP Code:
or die("Could not complete query because ."mysql_error()); 
feraira is offline
Reply With Quote
View Public Profile
 
Old 06-18-2005, 10:29 PM
Experienced Talker

Posts: 32
Trades: 0
try doing this
PHP Code:

 $category 
trim($_POST['category']); 
trim -- Strip whitespace (or other characters) from the beginning and end of a string
rcubes85 is offline
Reply With Quote
View Public Profile
 
Old 06-19-2005, 08:38 AM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
ok no worries - problem solved

thanks anyway
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Reply     « Reply to Problems getting variable values - very strange
 

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