How to pass a form value from one page to another

Yes. The filename only matters to the Apache Web server. Files which
end in .html are passed through Apache without any further
consideration. Files which end in .php are “handed off” to the PHP
interpreter. Any code contained within the <?php ?> delimiters is
evaluated by PHP, variables are converted to their values, code is
executed, and the result (what is sent to the browser) is pure HTML.
None of the PHP remains.

On the other hand, if you put PHP code in a .html page, it will be
passed through in the clear to the browser, which will usually hide it
from the visitor, but will not strip it out in any way.

Walter

On Feb 2, 2009, at 5:56 AM, Philip Caplan wrote:

Am I correct in thinking that a page ending “.php” which contains
only valid HTML will render the same in all browsers as if it had
ended “.html” ? The only difference is that anything between <?PHP and ?> gets evaluated and the result inserted if the file ends “.php”.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi again Walter

As I described in my reply sent at 9:56am, I realised that the page I was sending to ended “.html”

By changing that to “.php” I now get the contents of the script to appear on my “gotopage.php” but nothing shows up for the variable $name.

Not an error (which would surely happen if the sending page hadn’t sent a value) or the value (which should be a valid-looking email address because the form on gofrompage is being validated as an email address by FormsToGo (although FTG passes anything with an @ in the middle and “.anytwoletters” at the end!)!

What could cause that? The two pages are at:
www.personality.co.uk/test/gofrompage.html
and
www.personality.co.uk/test/gotopage.php

PHILIP


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 2 Feb 2009, 9:56 am, Philip Caplan wrote:

Mike, thanks for that, the penny is beginning to drop. :slight_smile:

Now, back to my comment “sort of works” above. It generates the text “Your email address is:” but doesn’t put a value after it! Your last message implies that by having a field in the previous page called ‘email’ will make it not work, but doesn’t the PHP code say:

$name = $_POST[‘email’];
(meaning: put into a variable called name the value passed in ‘email’)

and since the Error variable is not being shown, shouldn’t the content of $name be shown?

I wasn’t implying it wouldn’t work, just trying to cut down on the confusion with different variable names. If the field you are bringing the value from is email then keep the rest of the ones that pertain to that value as email, the code you use is passing from name to email and then the variable name is beinf checked for an error, if you get the variable name in a easy to read and understand pattern then it illiminates problems easier. In a small thing like this it is bad enough but imagine when you have a larger form and variable names change just for the sake of it!

If I had used $sentEmail (or any other valid variable-name) instead of both occurrences of $name wouldn’t that be equally OK?

Still trying to learn! :slight_smile:

You can * generally * use what you want as a variable name long as there is no conflict with other php variables (protected or otherwise) and the name doesn’t start with a digit, again I pointed this out only to avoid confusion at a later date… well at anytime actually!

NTH


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 2 Feb 2009, 11:48 am, Philip Caplan wrote:

Not an error (which would surely happen if the sending page hadn’t sent a value) or the value (which should be a valid-looking email address because the form on gofrompage is being validated as an email address by FormsToGo (although FTG passes anything with an @ in the middle and “.anytwoletters” at the end!)!

What could cause that? The two pages are at:
www.personality.co.uk/test/gofrompage.html
and
www.personality.co.uk/test/gotopage.php

PHILIP

There will only be an error as you mention on the email value if the form value is being checked… which seems to be happening. The forms to go script seems to be checking the first form values when they arrive at the second form, I don’t know how the FTG is added to your form… possible an include?

Might be simpler to just send a sample of the FW file to have a look at!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

How do I send you the Freeway file?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just click my username and you will see an email address to use under Contact Info, attached the FW file (Nothing else) and send it.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

  1. Change the gofrompage.html to gofrompage.php
  2. Change the form action value in gofrompage.php from the FTG script to gotopage.php (Puzzeled why that is there).
  3. Select the page in gofrompage.php and add the PHP Form-Page Action
  4. Select the email field and for the * value * enter $email so if at some stage you where to use a script to check the form values and the form was reloaded then the value entered in the email field would show there again.

As you will see the test form at gofrompage.php is now working.

HTH


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I don’t want to!

Joe

On Feb 2, 2009, at 1:23 PM, Gennaro Ponticelli wrote:

DELETE

Il giorno 01/feb/09, alle ore 16:09, Philip Caplan ha scritto:

Hi Mike

I downloaded your example file, un-zipped it into a newly-created
folder, and set that as the site folder, but when I tried to
preview it I got a warning “One or more HTML files which do not
belong to this site will be overwritten. Do you want to continue?”

Not wanting to take the risk (!) I say No.

How can I avoid the risk???


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options