473,761 Members | 10,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ph p_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 1863
*** 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************ ******@telecomp uteronline.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************ ******@telecomp uteronline.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_ph p_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************ ******@telecomp uteronline.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_ph p_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*******@attgl obal.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************ ******@telecomp uteronline.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************ ******@telecomp uteronline.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

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

Similar topics

1
3355
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 übergeben und in der Funktion auf $$string zugreifen. Geht sowas auch in Python?
1
4837
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 man diese Rechte abfragen? In welcher Tabelle stehen diese? Ingo
8
8624
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 column. Unfortunately, I don't know the corresponding function for the
24
7691
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 Dispose-Method and call the GC nothing happend!!! my Disposemethod has never been called!! so the GC dont call my Dispose-Method although I implemented IDisposable? what am i doing wrong?
1
1867
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 rückgabewert. hat damit jemand erfahrung und kann mir weiterhelfen? vielen dank schon mal im voraus gruss david
4
3235
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 dieses schon in einer Bibliothek vorgefertigt? (.NET und MFC steht mir zur Verfügung) Danke für die Hilfe!!!!!!
0
1598
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 part of the frame. I tried the following ways:
6
5931
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 or without parms. I know that any function that is passed to Eval() must be declared Public. It can be a Sub or Function, as long as it's Public. I even have it where the "function" evaluated by Eval can be in a form (class) module or in a standard...
0
10115
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8780
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.