eddy666 Posted March 25, 2009 Share Posted March 25, 2009 Alright, here is my problem. I have a form to buy some products. I enter quantity only for all the items I want to buy. I pass those values off to a php file as qty1, qty2, qty3, qty4. Well call that file process.php In process.php, the client has to enter his details. Example, name, phone number, email. Now I get stuck. I want to pass everything including the value of qty1-2-3-4 to email.php. I can get the form values of process.php which are his details. But I can't get the first html file values of qty1-4. Is it possible to pass them over to the 3 file? I was thinking of using hidden fields and assigning the value of the $qty1-4 to them except I don't know how to assign php variable to javascript DOM variables. Can anyone help? Please. Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted March 25, 2009 Share Posted March 25, 2009 use sessions at the top of each page that's not an include put session_start(); then just do $_SESSION['whatever']="whatever"; then you can access that from any page that you put the session_start on. Quote Link to comment Share on other sites More sharing options...
eddy666 Posted March 25, 2009 Author Share Posted March 25, 2009 Ok, quick question on that. Let's say I use session. I have a field on file 1 called qty1. So in sessions this code... <? php $_SESSION['whatever']=how do I reference my input field? ?> Or do I do it in file 2 after submitting the form? like this $_SESSION['whatever']= $_POST['qty1'] and from file 3, I just can get the value of whatever without needing to submit? Is the syntax and ideology correct? Quote Link to comment Share on other sites More sharing options...
dubc07 Posted March 25, 2009 Share Posted March 25, 2009 check this out http://v3.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart Quote Link to comment Share on other sites More sharing options...
eddy666 Posted March 25, 2009 Author Share Posted March 25, 2009 Ok, I have something going. If I get stuck, I'll be back again. Thanks for the help Quote Link to comment Share on other sites More sharing options...
br0ken Posted March 25, 2009 Share Posted March 25, 2009 If process.php receives the quantity values you use the following code to store it in a hidden input field. echo "<input type=\"hidden\" name=\"qty1\" value=\"".number_format($_GET['qty1'], 0, "", "")."\">"; Then when you submit the form in process.php, these values are passed to email.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.