Jump to content

Catching variables


Perfidus

Recommended Posts

Hi there!

 

I have a bunch of vars like tipo1, tipo2, tipo3, tipo4 sent via POST...

The number may vary depending on user choice.

I would like to recover the vars in an array, but the way I'm trying is not working:

 

for($i=0;$i<$numberoftipos;$i++)
{
$tipo2=array($tipo[$i]);
echo $tipo2[$i]."<br>";
}

 

It echoes nothing...

Any hints?

Changing var names is not possible, I can't rename them like tipo[] because they come from multiple radio buttons, so they need differente names or only 1 will be able to be checked in a big list !!!

Link to comment
Share on other sites

I would like to recover the vars in an array

 

What does that meen? There already in an array, the $_POST array. Explain exactly what your trying to achive.

 

Also, its easiest to loop through posted vars with a foreach(). eg;

 

<?php

  foreach($_POST as $k => $v) {
    echo "$k = $v<br />";
  }

?>

Link to comment
Share on other sites

As I said, I can't rename them like tipo[] because they come from multiple radio buttons, so they need differente names or only 1 will be able to be checked in a big form !!!

I'm sending lot's of vars using whatevername[] from the forms to automatically create the arrays, but with the radio buttons, I can't use the tipo[] name because then is impossible to check more than 1 option.

 

 

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.