Scope Problem?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fleet
Forum Newbie
Posts: 1
Joined: Tue Sep 12, 2006 8:10 pm

Scope Problem?

Post by fleet »

I have two php files - form.php, recap.php

form.php contains the php code for both files.

form.php is basically a form filled in by the user

recap.php display a recap of the information collected from the form.php. An array of the information contains a quantity field which is updated by the form input.

I move from form.php to recap.php by use of:

<?php
if (isset($_POST['continue'])) {
include recap.php;
exit();
}

recap.php displays an html table recaping the quantities, prices, etc. from the $products array.
At the same time I create a mail() $body variable with the same information, basically $body .= "[array info]". I know the $body variable is being created (I can display it in the html table).

Recap.php also has a form requesting name and e-mail for use in the mail() message.

Back in form.php, I use if (isset(submit1)) to sent a mail message. I seem to be able to use everything from the recap.php file EXCEPT the $body variable.
ie. the variable in mail($addressee, $subject, $body, $headers) are all good except the $body variable. Nothing I do seems to be able to allow the use of this variable.

This is driving me nuts! Any hints? (Sorry for being a little long-winded.)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I think it may be difficult to say without seeing your code.
Post Reply