Forum Moderators: open

Message Too Old, No Replies

Java variables not going to my PHP file?

Java variables not going to my PHP file?

         

ensign

2:16 am on Dec 14, 2004 (gmt 0)



For some reason, my java variables are not showing up when i try to display them in my PHP code on a different page. I am doing a website for my class that is required to be e-commerce related (shoppinh cart, products, etc). If you visit it: [ist.pct.edu...]

Try to order a few items, then check out. Fill out the information and when you get to the last page, you will see that none of the information from my javascript form worked. Please let me know if you can fix it. I am defining my variables as so:

$fname = $_POST[fname];
$lname = $_POST[lname];
$address = $_POST[address];
$city = $_POST[city];
$state = $_POST[state];

etc, etc, etc...

PS: I AM USING SESSIONS ON ALL PAGES, does that have anything to do with this, maybe?

any help would be appreciated! :(

orion_rus

4:05 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



it's not a JSCript question but))
if u make a $variable=$_POST[]
u need make post like there:
$variable=$_POST['variable']
(') is necessary
Good luck

StupidScript

12:54 am on Dec 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To send information between pages using the $_POST[] array, include them in hidden form elements or as part of the URI:

<form method="post" action="nextpage.php">

<input type="hidden" name="fname" value="<?=$_POST["fname"]?>">

<input type="text" name="lname">

This example gets the hidden "fname" element's value from the previous page, where the user filled out and submitted a form with a visible "fname" field. When the request and the POST data was sent to the second page, the $_POST[] array contained the POST data for you to pick up and carry over.

or, in your case:

<a href='form.php?item[]=<?=$_POST["item"]?>&qty[]=<?=$_POST["qty"]?>&cost[]=<?=$_POST["cost"]?>'>Check Out</a>

You'll need to iterate through the various $_POST[] arrays (foreach, or whatever) to populate the final "Check Out" URI.

Keep on collecting hidden variable data as you go along, and in the final stage, you should have the whole dataset to pass along to the order confirmation et al.