PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 14th, 2004, 01:20 PM
nmphpwebdev nmphpwebdev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 nmphpwebdev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
insert statement has me stumped.

I have this insert statment:

PHP Code:
<?php

$content_title 
'Home Page Administration';
$page_title 'Index Page Options';

include( 
'../includes/subheader.php' );
include_once( 
'../includes/dbconnect.php' );

if( isset( 
$_POST['action'] ) == 'Submit Info' )
    { 
//Handle the form

    // Create a function for escaping the data.
function escape_data ($data) {
         
// Need the connection.
                
global $dbc;
                if (
ini_get('magic_quotes_gpc')) {
                    
$data stripslashes($data);
                }
                return 
mysql_real_escape_string($data);
        } 
// End of function.

    //Create a blank variable
$message NULL;

//Check for content title
if( empty( $_POST['title'] ))
    {
         
$t FALSE;
         
$message .= "<p><font color=\"red\">You need to title your post</font></p>";
    } else {
            
$t escape_data$_POST['title'] );
            }

//Check for content to be submitted.
if( empty( $_POST['content'] )) {
        
$c FALSE;
        
$message .="<p><font color=\"red\">You can\'t display a blank home page!!</font></p>";
        } else {
                
$c escape_date$_POST['content'] );
                }

//Check for an image to be posted.
if( empty( $_POST['img'] )) {
     
$i FALSE;
     
$message .="<p><font color=\"red\">You can\'t have a missing image</font></p>";
     } else {
     
$i $_POST['img'];
             }

//Check for img description
if( empty( $_POST['imgdesc'] )) {
        
$imgdesc FALSE;
        
$message .="<p><font color=\"red\">We need a description for this image!!</font></p>";
        } else {
                
$imgdesc escape_data$_POST['imgdesc'] );
                }

//Check for date to display
if( empty( $_POST['datetodisplay'] )) {
        
$dm FALSE;
        
$message .= "<p><font color=\"red\">When do you want this to display?</font></p>";
        } else {
                
$dm $_POST['datetodisplay'];
                }
if( 
$t && $c && $i && $imgdesc && $dm )
    {
             
$sql "INSERT INTO indexpage
             ( id, title, content, datemod, img, imgdesc, datetodisplay )
             VALUES
             ( '', '$t', '$c', now(), '$i', '$imgdesc', '$dm' )"
;
              
//$result = mysql_query( $sql );

              
$result mysql_query($sql) or die ("INSERT INTO DATABASE FAILED: ".mysql_error());

            }
//Print the messge if there is one
if( isset( $message )) {
        echo 
'<font color=\"red\">' $message '</font>';
        }
    }
?>


I am not able to send the post variables to the database, its not giving my red messages for missing fields, nothing.

Any ideas??

Reply With Quote
  #2  
Old October 14th, 2004, 01:34 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 331 Viper_SB User rank is Private First Class (20 - 50 Reputation Level)Viper_SB User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 4 h 53 m 7 sec
Reputation Power: 6
People (including me) have already been answering your question at Devshed go back there to get the answer.

Reply With Quote
Closed Thread

Viewing: Dev Articles Community ForumsProgrammingPHP Development > insert statement has me stumped.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT