RE: [PHP] combining variables...

2004-04-06 Thread Vishal Patel
You could dynamically generate variable names using:

${view_request_}.$i} = $value;

This will generate:
$view_request_1
$view_request_2
...

Vishal.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 1:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP] combining variables...


Simply put, can I connect 2 variables, to make one...

I want to output:
$view_request_$i

making for example a string:
view_all_2

But I'm getting errors..?
Parse error: parse error in /home/risk/public_html/download/results3.php 
on line 675

is there a simple explination...?


*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Passing form values to PHP

2004-03-30 Thread Vishal Patel
Try this:

extract($_POST);

extract --  Import variables into the current symbol table from an array

All of my forms have worked without $_POST or $_GET. Is there a reason for
inavailability of variables???

Its a good practice to use $_POST for security reasons.

Vishal.

-Original Message-
From: Ciemny, Jessica [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 30, 2004 10:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing form values to PHP


Hey every, I'm new to the group and to PHP (3 days now) and I would like to
ask a question. I purchased a book on PHP a day or so ago and as I'm going
through the book it comes to a point where it talks about passing html form
values to PHP. So I type up the examples from the book, both the html file
and the PHP file and I run it and I don't get anything when the PHP file is
accessed. H puzzling! I don't get any errors at all, but the values just
aren't coming across.

The book says that I should be able to take the name=xyz value from the
HTML form and just use it as a regular variable ($xyz) in the PHP file. But
this doesn't work.

After much digging on web pages and through email lists I found reference to
something called the $_POST variable. This seems to be the only way that I
can make the PHP file use the name=xyz values from the HTML file. So in
the PHP file I would have to use the variable $_POST[xyz] to get the form
value returned.

Anyone have any ideas as to what's up. I hope its just something silly that
I'm missing being a newby to PHP and all.

I will include small versions of the file here for reference:

HTML FILE
-

htmlbody
form action=x.php method=post
Please enter your name:
input type=text name=xyz
input type=submit value=submit
/form
/body/html


PHP FILE (Doesn't Work)
-
htmlbody
?php
echo(The value of name is $xyz);
?
/body/html


PHP FILE (Does Work)
-
htmlbody
?php
echo(The value of name is $_POST[xyz]);
?
/body/html

So I guess my question ultimately is, what are the different ways in which
form data can be passed to a PHP script?

Thanks you,

Jessica

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php