Jump to content


Photo

help with $_POST


  • Please log in to reply
5 replies to this topic

#1 keithschm

keithschm
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 29 March 2006 - 02:03 PM

ok so I have a form that reads and writes to a datbase no problem.

when the page loads it has a drop down menu with data and I can pick a name and hit view edit delete, or new to enter a new entry

I am doing these options with

if(isset($_POST['view'])){

and an entry with view/edit etc..

I want when the first page loads to show some data, but only on the first load. not when view or edit is selcted

do I ned an if or what. I am not sure.

Thanks
NEED HELP

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 29 March 2006 - 02:07 PM

You need a if/else:

<?php
if(isset($_POST['view']))
{
     // do whatever
}
else
{
    // show data
}
?>

You can add more to that if you want certain things to happen if something else in the post is set. Just add an "else if(isset(whatever)).

Info: PHP Manual


#3 keithschm

keithschm
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 29 March 2006 - 04:22 PM

so I shoud do



if(isset($_POST['view']))
{
     // do whatever
}

if(isset($_POST['edit]))

{

do what ever
}

if(isset($_POST['new']))


{
do what ever
}

else
{
    // show data
}
?>

NEED HELP

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 29 March 2006 - 04:25 PM

<?php
if (isset($_POST['view']))
{
     // view!
}
elseif(isset($_POST['edit]))
{
   // edit!
}
elseif(isset($_POST['new']))
{
   // new!
}
else
{
    // show data
}
?>

Info: PHP Manual


#5 keithschm

keithschm
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 29 March 2006 - 04:29 PM

thank you
NEED HELP

#6 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 29 March 2006 - 04:37 PM

Anytime.

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users