Jump to content

Forms and php


eddy666

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/151118-forms-and-php/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/151118-forms-and-php/#findComment-793866
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/151118-forms-and-php/#findComment-794053
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.