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
isset(_POST['submit']) issue!!!! Thank you!
Old 06-25-2010, 06:51 PM isset(_POST['submit']) issue!!!! Thank you!
Junior Talker

Posts: 1
Name: kevin
Trades: 0
Dear My Friends,

I click on the submit button, but it is not work, i test the code and found that the if(isset(_POST['submit'])) is never set.

What's the Problem? Thank you for your help!

here is the code:
PHP Code:
<?php

require("config.php");

if(isset(
$_GET['id']) == TRUE) {
      if(
is_numeric($_GET['id']) == FALSE) {
       
$error 1;
      }
      else
      {
        
$error =0;  
       }
      if(
$error == ) {
         
header("Location: " $config_basedir);
      }
      else {
        
$validentry $_GET['id'];
     }
}
else {
  
$validentry 0;
}


if(isset(
$_POST['submit'])){
            
        
          
$db mysql_connect($dbhost$dbuser$dbpassword);
          
mysql_select_db($dbdatabase$db);
          
          
$sql "INSERT INTO comments(blog_id, dataposted, name, comment) VALUES(" 
                
$validentry ", NOW(), '" $_POST['name'] . "', '" $_POST['comment'] . "');";
        
mysql_query($sql);
        
        
header("Location: http://" $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . 
        
"?id=" $validentry);
}

else{

        require(
"header.php");
        
        if(
$validentry == 0) {
            
$sql "SELECT entries.*, categories.cat FROM  entries, categories " 
            
"WHERE entries.cat_id = categories.id " 
            
"ORDER BY dateposted DESC " .
            
" LIMIT 1;";
        }
        else {
            
$sql "SELECT entries.*, categories.cat FROM  entries, categories " 
            
"WHERE entries.cat_id = categories.id AND entries.id = " $validentry 
            
" ORDER BY dateposted DESC LIMIT 1;";
        }
        
$result mysql_query($sql);
        
$row mysql_fetch_assoc($result);
        echo 
"<h2>" $row['subject'] . "</h2><br />";
        
        echo 
"<i>In <a href='viewcat.php?id=" $row['cat_id'] . "'>" $row['cat'] . 
        
"</a> -  Posted on " date("D jS F Y g.iA"strtotime($row['dateposted'])) . "</i>";
        
        echo 
"<p>";
        echo 
nl2br($row['body']);
        echo 
"</p>";
        
        
$commsql "SELECT * FROM  comments WHERE blog_id = " $validentry 
            
" ORDER BY dateposted DESC;";
        
$commresult mysql_query($commsql);
        
$numrows_comm mysql_num_rows($commresult);
        
        if(
$numrows_comm ==0) {
           echo 
"<p> No comments. </p>";
         }
        else {
         
$i 1;
        
         while(
$commrow mysql_fetch_assoc($commresult)) {
          echo 
"<a name='comment" $i "'>";
          echo 
"<h3>Comment by " $commrow['name'] . " on " date("D jS F Y g.iA"
          
strtotime($commrow['dateposted'])) . "</h3>";
          echo 
$commrow['comment'];
          
$i++;
         }
        }
        
        
?>
        
        <h3>Leave a comment</h3>
        
        <form action="<?php echo $_SERVER['SCRIPT_NAME'] . "?id=" $validentry?>" method="post">
        <table>
        <tr>
          <td> Your name</td>
          <td><input type="text" name="name"/></td>
        </tr>
        <tr>
          <td>Comments</td>
          <td><textarea name="comment" rows="10" cols="50"></textarea></td>
        </tr>
        <tr>
          <td><input type="submit" name="submit" value="Submit"/></td>
        </tr>
        </table>
        </form>

<?php
  
}
require(
"footer.php");
?>

Last edited by chrishirst; 06-25-2010 at 07:02 PM..
kindtiger is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to isset(_POST['submit']) issue!!!! Thank you!
 

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