?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?php help
Author:??(24.42.74.---)
Date:???03-19-03 08:49

I need a little help writing my first php script.

My problem right now is passing information from one php file to an other...

I have 2 files, the fisrt (create_entry_form.php) contains this:

Note: I want to pass the info collected in this form to a file called create_entry.php
I have written this line to do so (but it does not seem to work)


---file start---


My address book version 1.0








Add entries to address book



Nom:



No. de tel de maison:



No. de tel cellulaire:



No. de tel de travail:



Addresse:



Ville:



Code Postal:



E-mail:



URL:











---file end---

This is my second file (create_entry.php) that should have my info (but it does not...

Note: I can find my info in the variable $HTTP_POST_VARS but if I only use $submit which should contain "Add" because I put a submit button in my first file but it does not.


---file start---


My address book version 1.0







include("db_address_book_connect.php");
print ("
Submit before if -> $submit <-
");


while (list($name, $value) = each($HTTP_POST_VARS)) {

echo "$name = $value
\n";

}

print ("$HTTP_POST_VARS
");

if ( $submit == "Add" ) {
$query = "insert into entries
(name,phone_num,cell_num,work_num,address,city,postal_code,email,url) values
('$name','$phone_num','$cell_num','$work_num','$address','$city','$postal_code','$email','$url')"
;
mysql_query($query) or
die (mysql_error());
?>

The entry has been added!


View My Address Book!!!



} else {

include("create_entry_form.php");
print "
Submit after if -> $submit <-
";
}

?>





---file end---


What am I doing wrong?? Why does the variable $submit not contain "Add" when passed from create_entry_form.php to create_entry.php?

I'm obviously doing something wrong but can't figure it out...

My web server is Apache version 1.3.26-win32-x86
I have MySQL server running, version 3.23.53
MyODBC version 3.51.06
my OS is WinXP
and I'm using PHP 4.04 (I think...)

Any help would be greatly appreciated, you can reach me at [email protected]

Thanks in advance.. Yves

?Topics Author? Date
?php help??new
Yves 03-19-03 08:49?
?Re: php help??new
bastien 03-20-03 06:32?
?Re: php help??new
Randy Rovang 10-26-04 18:50?
?Re: php help??new
irfan ullah khan 03-21-03 22:33?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > I need a little help writing my first php script. > > My problem right now is passing information from one php file > to an other... > > I have 2 files, the fisrt (create_entry_form.php) contains > this: > > Note: I want to pass the info collected in this form to a > file called create_entry.php > I have written this line to do so (but it does not seem to > work) >
> > ---file start--- > > > My address book version 1.0 > > > > > > > > >

Add entries to address book

> > Nom: > >
> No. de tel de maison: > >
> No. de tel cellulaire: > >
> No. de tel de travail: > >
> Addresse: > >
> Ville: > >
> Code Postal: > >
> E-mail: > >
> URL: > >
> > > > > > > > > ---file end--- > > This is my second file (create_entry.php) that should have my > info (but it does not... > > Note: I can find my info in the variable $HTTP_POST_VARS but > if I only use $submit which should contain "Add" because I > put a submit button value="Add"> in my first file but it does not. > > > ---file start--- > > > My address book version 1.0 > > > > > > > > include("db_address_book_connect.php"); > print ("
Submit before if -> $submit <-
"); > > > while (list($name, $value) = each($HTTP_POST_VARS)) { > > echo "$name = $value
\n"; > > } > > print ("$HTTP_POST_VARS
"); > > if ( $submit == "Add" ) { > $query = "insert into entries > (name,phone_num,cell_num,work_num,address,city,postal_code,email,url) values > ('$name','$phone_num','$cell_num','$work_num','$address','$city','$postal_code','$email','$url')" > ; > mysql_query($query) or > die (mysql_error()); > ?> > >

The entry has been added!

>

View My Address Book!!!

> > } else { > > include("create_entry_form.php"); > print "
Submit after if -> $submit <-
"; > } > > ?> > > > > > > ---file end--- > > > What am I doing wrong?? Why does the variable $submit not > contain "Add" when passed from create_entry_form.php to > create_entry.php? > > I'm obviously doing something wrong but can't figure it out... > > My web server is Apache version 1.3.26-win32-x86 > I have MySQL server running, version 3.23.53 > MyODBC version 3.51.06 > my OS is WinXP > and I'm using PHP 4.04 (I think...) > > Any help would be greatly appreciated, you can reach me at > [email protected] > > Thanks in advance.. Yves ">??

Provided By
Phorum