You are here: Re: call php funktion from form « PHP Programming Language « IT news, forums, messages
Re: call php funktion from form

Posted by Jerry Stuckle on 06/15/05 14:37

Carramba wrote:
> On Wed, 15 Jun 2005 11:25:28 +0200, Alvaro G Vicario
> <alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote:
>
>> *** Carramba wrote/escribió (Wed, 15 Jun 2005 11:20:57 +0200):
>>
>>> but does it means that I can reffer in action to some_php_script.php,
>>> and the from it declaire $foo = $_POST['foo'] and after words call
>>> function foo_function( $foo ) or foo_function( $_POST['foo'] )?
>>
>>
>> I guess English is not your mother tongue :) Form fields are created
>> using
>
> yes you are so right :-P
>
>> HTML. If you don't want to display the form you can make it of hidden
>> type:
>>
>> <input type="hidden" name="foo" value="Whatever">
>>
>>
>>> how would it work if functions are in different *.php scrips?
>>
>>
>> You must understand that PHP is server-side and browsers cannot
>> execute PHP
>> at all. They merely load URLs and that triggers whatever PHP code you
>> have
>> placed there.
>
>
> I know that
>
>>
>>> if I include
>>> them it ll work fine, but to by more precises I'am asking if there is a
>>> way to call different function in different script pages?
>>
>>
>> Sorry, I can't figure out what you need. You can call as many
>> functions as
>> you want, just type their names and end each line with a semicolon. But I
>> suppose you already know that :-?
>
>
> suppose I have functions in diffrenst scripts, thouse funktins are used
> not only in forms,
> for ex I wan't to call check_email() wich is in form_check.php for
> e-mail feeld in form,
> then I want to imput name in database wich is dome with insert_db() in
> db_handling.php
> so my question: how can I call thouse funktions without including them
> in some_php_script.php (<form method="POST" action="some_php_script.php">)
> so I send them dicectly to those funktions in thouse script collections
> I wan't to do that becouse I think it woud by quicker script execution
> hoppe I make myself clear now..
>
>

Carramba,

If I understand you correctly, you want to call a function which is in a
script other than the one currently running. To do this, you must
include the second script.

For instance, in script1.php you might have (on Apache):

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/include/script2.php');
...
?>

All the functions in script2.php are now available to be called by
script1.php. The $_SERVER['DOCUMENT_ROOT'] is required because PHP
operates on the file system itself. It means you need to add the root
path to the web server files yourself.

Is this what you mean?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация