Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you call a script from another script? 1

Status
Not open for further replies.

piperent

Programmer
Feb 7, 2002
156
US
PHP neophite having a little problem with script timing and execution.

Can one PHP script initiate the execution of another PHP script? If so, how is this accomplished?

I have a simple 'PULL-DOWN' menu with 2 'select' frames as listed (yes, they do have the necessary html form wrappers to make a proper form):

<TABLE cellSpacing=0 cellPadding=3 width="75%" align=center border=5>
<TR>
<TD vAlign=center align=right bgColor=#cccccc><LABEL><FONT
face="Arial, Helvetica, sans-serif" size=3>Customer
Selections</FONT></LABEL></TD>
<TD bgColor=#cccccc><SELECT name=cust_choice>
<OPTION selected>Choose ...</OPTION>
<OPTION value=custm_mnt.php>Customer Maintenance</OPTION>
<OPTION value=custm_list.php>Customer List</OPTION>
<OPTION value=custm_srch.php>CustomerSearch</OPTION>
</SELECT> </TD></TR>
<TR>
<TD vAlign=center align=right bgColor=#cccccc><LABEL><FONT
face="Arial, Helvetica, sans-serif" size=3>Vehicle
Selections</FONT></LABEL></TD>
<TD bgColor=#cccccc><SELECT name=veh_choice>
<OPTION selected>Choose ...</OPTION>
<OPTION value=veh_checkin.php>Check-in</OPTION>
<OPTION value=veh_start.php>Add/Chg/Delete</OPTION>
<OPTION value=veh_list.php>List Vehicles</OPTION>
</SELECT></TD></TR>

When the form is 'submitted', I call an intervening PHP script (action="interim.php")that parses the values of 'cust_choice' and 'veh_choice' to determine where to go. This gives the interim script the name of the PHP script to be called. Since this is all server side code can that script-name be acted on in the same fashion as you would, in say, a Unix shell script? Or, does the parsing logic need to be in the same script as the form?

No doubt my abilities are sub-standard in this effort for I have an old line 'procedural code' background, but surely there is a way to execute one PHP from another.

Any insite would be appreciated, and if I'm totally out in left field, just let me know and I'll back up and take some other approach.

Thanks for your time and input.

J Piper
 
1. The parsing logic doesn't have to be in the same script as the form.
2. The parsing logic can evaluate the posted information and use a header() command to direct the client to the appropriate page via a HTTP location header.

If there are values to passed from one page to another (beyond the script receiving the posted data), it get's just a tiny bit more complicated.
 
I knew there had to be some way to accomplish this. It's just a bit beyond my current level of expertise (which is basically 'none' :)). I'll throw you a star for the quick response and clarity - I've searched thru-out this site for some answer to this but couldn't find anything that seemed to relate.

Thanks for the help.

JP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top