Click here to Skip to main content
12,405,700 members (63,130 online)
Rate this:
 
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 14: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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2016
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