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
problem with post data
Old 09-04-2007, 02:58 AM problem with post data
Novice Talker

Posts: 12
Trades: 0
how to make the empty data in the form will not be inserted into the database when the user click the submit button...
can anyone show me the coding?..please..
blue_meteor is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-04-2007, 04:06 AM Re: problem with post data
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Ok, well from what i understand form your question.

You use VALIDATION!!!

which you should ALWAYS do remember the golden rule NEVERN TRUST THE USER!

user can do all sorts of nasty things through forms and logins and everything else.

which is why u must protect it

you should use mysql_real_escape_string() which protects your from sql injection.

so you should do:

PHP Code:
$inputvar =   =(isset($_POST['input']))      ? mysql_real_escape_string($_POST['input'],$link_db)      : ''
then you can do soemthing like

if(!empty($input1) || !empty($input2))
{
//insert it into your database
mysql_query("insetr into db ehrenek") or die ()
}
else {
echo "form not posted because input 1 and 2 are empty!!!";
}

i would advise to add aload more validation than that tho, you should ensure beyond doubt that the info you are saving is what you want it to be.

if it suposed to be a number make sure its a number (is_numeric) remove HTML from it unless it should have HTML, basically clean it as much as possible.

If you would like me to write the valdiation for your form(s), and i would do it cheap

Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to problem with post data
 

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