473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

call php funktion from form

hi!

I don't have eny code to chare, this is just teoretical question.
usualy you have for looks like
<form method="POST" action="some_php_script.php">
namn: <input type="text" name="name" size="20">
<br>
city <input type="text" name="city" size="20">
<input type="submit" value="Submit"><input type="reset">
</form>

what I am wondering how it would by possible to send name to one funktion
in some_php_script.php and city to another?
I mean if I have some_php_script.php
<?
name_funktion( $name ){
code...
code..
}

city_funktion( $city ){
code...
code..
}
?>

so I want to send parameter name from form to name_funktion() and city to
city_funktion()
--

Thanx in advance
________________________
BTW. I know my english is not best in the word, so please stop bugging me
about my spelling. And yes Iam sorry you don't understand what I mean, but
there is no point to yell at me. Have a nice day.

Jul 17 '05 #1
10 1841
*** Carramba wrote/escribió (Wed, 15 Jun 2005 10:24:31 +0200):
so I want to send parameter name from form to name_funktion() and city to
city_funktion()


You can read form fields from the $_POST associative array this way:

<input name="foo" ... >

echo $_POST['foo'];
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2
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'] )?
how would it work if functions are in different *.php scrips? 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?
On Wed, 15 Jun 2005 10:51:54 +0200, Alvaro G Vicario
<al******************@telecomputeronline.com> wrote:
*** Carramba wrote/escribió (Wed, 15 Jun 2005 10:24:31 +0200):
so I want to send parameter name from form to name_funktion() and city
to
city_funktion()


You can read form fields from the $_POST associative array this way:

<input name="foo" ... >

echo $_POST['foo'];


--

Thanx in advance
________________________
BTW. I know my english is not best in the word, so please stop bugging me
about my spelling. And yes Iam sorry you don't understand what I mean, but
there is no point to yell at me. Have a nice day.

Jul 17 '05 #3
*** 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
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.

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 :-?
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #4
On Wed, 15 Jun 2005 11:25:28 +0200, Alvaro G Vicario
<al******************@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..
--

Thanx in advance
________________________
BTW. I know my english is not best in the word, so please stop bugging me
about my spelling. And yes Iam sorry you don't understand what I mean, but
there is no point to yell at me. Have a nice day.

Jul 17 '05 #5
Carramba wrote:
On Wed, 15 Jun 2005 11:25:28 +0200, Alvaro G Vicario
<al******************@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.
js*******@attglobal.net
==================
Jul 17 '05 #6
*** Jerry Stuckle wrote/escribió (Wed, 15 Jun 2005 06:37:35 -0500):
require_once($_SERVER['DOCUMENT_ROOT'] . '/include/script2.php');


I was about to answer this. One more comment: it's a good idea to use a
special extension to distinguish this sort of files. I normally use
something like "functions.inc.php".
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #7
On Wed, 15 Jun 2005 12:50:30 +0200, Alvaro G Vicario
<al******************@telecomputeronline.com> wrote:
*** Jerry Stuckle wrote/escribió (Wed, 15 Jun 2005 06:37:35 -0500):
require_once($_SERVER['DOCUMENT_ROOT'] . '/include/script2.php');


I was about to answer this. One more comment: it's a good idea to use a
special extension to distinguish this sort of files. I normally use
something like "functions.inc.php".


thank you bouth!
I was looking for thouse answers.
my past in java/haskell/c have left some deep wounds, so Iam having
trouble thinking php :P
--

Thanx in advance
________________________
BTW. I know my english is not best in the word, so please stop bugging me
about my spelling. And yes Iam sorry you don't understand what I mean, but
there is no point to yell at me. Have a nice day.

Jul 17 '05 #8
*** Carramba wrote/escribió (Wed, 15 Jun 2005 12:57:04 +0200):
my past in java/haskell/c have left some deep wounds, so Iam having
trouble thinking php :P


Java makes bad things to human brain.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #9
On Wed, 15 Jun 2005 13:05:14 +0200, Alvaro G Vicario
<al******************@telecomputeronline.com> wrote:
*** Carramba wrote/escribió (Wed, 15 Jun 2005 12:57:04 +0200):
my past in java/haskell/c have left some deep wounds, so Iam having
trouble thinking php :P


Java makes bad things to human brain.


lol
--

Thanx in advance
________________________
BTW. I know my english is not best in the word, so please stop bugging me
about my spelling. And yes Iam sorry you don't understand what I mean, but
there is no point to yell at me. Have a nice day.

Jul 17 '05 #10
On Wed, 15 Jun 2005 13:05:14 +0200, Alvaro G Vicario
<al******************@telecomputeronline.com> wrote:
*** Carramba wrote/escribió (Wed, 15 Jun 2005 12:57:04 +0200):
my past in java/haskell/c have left some deep wounds, so Iam having
trouble thinking php :P


Java makes bad things to human brain.


shame you website is non-english..

--

Thanx in advance
________________________
BTW. I know my english is not best in the word, so please stop bugging me
about my spelling. And yes Iam sorry you don't understand what I mean, but
there is no point to yell at me. Have a nice day.

Jul 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Torsten Mohr | last post by:
Hallo, ich möchte eine Funktion schreiben, der ich eine Referenz auf einen String übergeben kann und die dann einige Änderungen am String vornimmt. In Perl würde ich also ein \$string...
1
by: Ingo Kollesch | last post by:
Moin, gibt es eine DB2 Funktion/Abfrage oder View um die User/User Group abzufragen? Ich möchte in meiner Anwendung abfragen ob der eingeloggte User bestimmte Rechte auf der Datenbank hat. Kann...
8
by: Dirk Deimeke | last post by:
Hello, we have a database with one column CHAR(10), which contains numeric data (10 digits). (That was not my idea). Now, I have to find out all rows, which do not have numeric data in this...
24
by: Jazper | last post by:
hi i have this problem. i made a class deverted by CRootItem with implementation of IDisposable-Interface. i made a test-funktion to test my Dispose-Method.... but when set a breakpoint in my...
1
by: David Fedier | last post by:
hallo bei einer dll die ich am schreiben bin benutze ich bei einer funktion ein struct als rückgabewert. und wenn ich diese dll in einem anderen projekt einbinden will bekomme ich keinen...
4
by: ulikoehler | last post by:
Hallo! Ich suche für mein Programm eine Zufalsszahl-Funktion, die eine große Anzahl von 'Zufalls'-Zahlen in einer kleinen Zeit generiert (~50000/s). Muss ich mir diese selbst programmieren oder ist...
0
by: Petra | last post by:
Hello! I'm developing my first website with ASP. Now I seached the hole internet for a answer, but nobody seems to have the same problems as I am: I like to refresh a frame from another...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.