Jump to content

Archived

This topic is now archived and is closed to further replies.

keithschm

help with $_POST

Recommended Posts

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

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

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

Share this post


Link to post
Share on other sites
You need a if/else:

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

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)).

Share this post


Link to post
Share on other sites
so I shoud do


[code]

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

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

{

do what ever
}

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


{
do what ever
}

else
{
    // show data
}
?>
[/code]

Share this post


Link to post
Share on other sites
[code]<?php
if (isset($_POST['view']))
{
     // view!
}
elseif(isset($_POST['edit]))
{
   // edit!
}
elseif(isset($_POST['new']))
{
   // new!
}
else
{
    // show data
}
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.