Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP MySQL
Good day to you all
 
i'm new to php programing and i'm stuck could someone help please.
 
Here is my code
<?php
 
isset($_POST['op']) && $_POST['op'] != "add";
 
if ($_POST['op'] != "add" )
     {
      //havent seen form, so see it
     $display_block = "<h1>Add an Entry</h1>
       <form method = \"post\" action =\"$_SERVER[PHP_SELF]\">
 
the next part is my form and i end the form with
<p><input type = \"submit\"  name=\"submit\" value=\"Add Entry\"></p>
 
       </form>";
      }
     else if ($_POST[op] == "add" ) //check required fields
     {
      if (($_POST[Venue_name] == "") || ($_POST[Venue_date] == ""))
      {header("Location:addentry.php");
       exit;
     }
thank you
Posted 3-Jun-11 15:13pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is not much information, but did you check for type errors?
 
Like shouldn't it be $_POST['op'] in the second part?
And same for Venue_name and Venue_date.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The third line is unnecessary. Replace it with these:
if(isset($_POST['op']))
{
    // Insert your codes here
    // Additionally $_POST[op] is an invalid usage, it must be $_POST['op']
}
else
{
    // If there is no post variable whose name is 'op'
}
  Permalink  
v2
Comments
Chi Ller at 12-Sep-12 8:37am
   
That´s how I wanted to write it when I read the code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 370
1 Sergey Alexandrovich Kryukov 329
2 BillWoodruff 235
3 Afzaal Ahmad Zeeshan 209
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100