Jump to content

Serious PHP Help Needed


cfman

Recommended Posts

I have a form with dynamic text boxes that have dynamic names (i.e., TextBox1, TextBox2, etc.).  How do I get those variables passed into php?  I have tried and tried...even googled it, with no solid luck.  Any help, immediately, would be so much appreciated.

Link to comment
Share on other sites

Really did not solve anything....I have a form that has field names like:  Id_1, Id_2, etc.  There could be just one field (i.e., Id_1) or there could be 20 fields.  I need to be able to capture the variables in those fields.  Do I loop through the array, etc.?

Link to comment
Share on other sites

I have a form with dynamic text boxes that have dynamic names (i.e., TextBox1, TextBox2, etc.).  How do I get those variables passed into php?  I have tried and tried...even googled it, with no solid luck.  Any help, immediately, would be so much appreciated.

it is possible with the help of ajax xml or jquery. send me sample code I will tell you how to get result
Link to comment
Share on other sites

Did that and am able to get the results.  Now, how to actually put the results together.  For example, i have fields:  A1,B1,C1 and A2,B2,C2.  I need to output these variables into an email.  I got the email part figured out, no problem.  Just getting the form variables so they match up in the output:  A1 A2, B1 B2, C1 C2.

Link to comment
Share on other sites

Gonna need to see your code. We would be wasting our time, and yours, trying to guess how your form builds itself.  We love to help others, but it is very difficult to do so without relevant code.

 

foreach($_POST as $key => $value) {
if(is_array($value)) {
   foreach($value as $key2 => $value2) {
     echo $key2 . ' ' . $value2 . '<br />';
   }
}
}

 

This should print the variables to your page, it would take some more checks to line them up like you desire to do.

Link to comment
Share on other sites

I have attached the javascript file that builds the table and the hidden fields.  Also, it can be seen here (still under development, so please pardon):  http://www.usameddent.com/Test4.php?section=A.  Choose a quantity and add it to the cart.  Then click on the view cart link at the top left.  I come from a coldfusion background and am slowly wrapping myself around php as it is a nice language and I certainly appreciate the help.

 

[attachment deleted by admin]

Link to comment
Share on other sites

The way I handle dynamic forms is I create an array with them, so:

 

<input type="hidden" name="id[]" />

<input type="hidden" name="id[]" />

 

Which, on the next page will translate into

 

$_POST['id'][0];

$_POST['id'][1];

 

and so on.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.