GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Nov-2004, 00:26
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Calling a new page


As a neo phper, I keep running into things I know how to do in normal programming languages, but because of terminology differences I'm finding it difficult to find the info I need for web/php. So....

I have a form with 3 buttons:
PHP Code:

...
        print "<FORM ACTION='birpro.php' method='POST'>";

        print "<p><CENTER>";
        print "&nbsp;Number <input type='text' name='NumVal'  size='10'>&nbsp;";
        print "&nbsp;<input type='submit' name='del' value='delete'>&nbsp;";
        print "&nbsp;<input type='submit' name='mod' value='modify'>&nbsp;";
        print "&nbsp;<input type='submit' name='sto' value='modify story'>&nbsp;";
        print "</CENTER></p>";
... 



In birpro.php execute the following:
PHP Code:

...
        if (isset($sto))
        {
// This is the question area 
        }
        else
        {    
            if (isset($del))
            {
                $dv[$NumVal] = 1;
                $del = 1;
            }
            else
            {
                $mv[$NumVal] = 1;
                $del = 0;
            }
... 


If the sto button is clicked, I actually want to execute a different php script (story.php). Possible solutions, only one of which I know how to do:
  • is there a way to call the script directly from the form? (I doubt it)
  • in the if() for sto, how would I start the other script? (no clue)
  • use include to load the script into place. (is this a good solution?)
Thanks
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
  #2  
Old 10-Nov-2004, 18:37
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
You of all people will appreciate that there's no one correct answer in this situation. It all boils down to individual preference and style.

The simplest and perhaps the least complicated solution for this particular example may be the "include/require" solution. One of these, I can't remember which, will only load the "require(script)" if it's in the condition that's true.

Sometimes, it may be a lot more efficient to simply create little custom functions to handle each condition.
  #3  
Old 10-Nov-2004, 21:15
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Dang, forgot about the simplest version -- call a subroutine! I'm too used to HTML so I forgot I didn't have to actually call a separate page...

Thanks for the clue... I'll look into the require() command, too.
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
  #4  
Old 17-Nov-2004, 14:00
JasonMichael's Avatar
JasonMichael JasonMichael is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 135
JasonMichael has a spectacular aura about
My postings and articles about content manangement talk exclusively about using 'include' to load particular PHP scripts, depending on what area of the website you are browsing to.
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
next page skyloon MySQL / PHP Forum 5 17-Oct-2004 12:04
Position Error on Search page BobbyDouglas GIDForums™ 4 28-Jul-2004 16:35
[script] E-mail webmaster error page BobbyDouglas PHP Code Library 0 19-Aug-2003 20:10
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 10:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:36.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.