Help - Search - Members - Calendar
Full Version: [PHP] $_POST Variable
MSFN Forums > Coding, Scripting and Servers > Web Development (HTML, Java, PHP, ASP, XML, etc.)

   
Google Internet Forums Unattended CD/DVD Guide
darph
Hi
i got a problem to get some variable from a form

i set the variable with

<input type=\"hidden\" name=\"maxt1\" size=\"40\">
<input type=\"hidden\" name=\"maxt2\" size=\"40\">
<input type=\"hidden\" name=\"maxt3\" size=\"40\">
and send them with post to the next file.

action="xml.php?id=3"

in the new file i will echo all files but donīt know the way i tried this

for $i = 0; $i <=$_GET['id']; $i++)
{
echo $_POST['maxt$i'];
}

but the varialbes are empty ?
whats the misstake i made ?

thx

darph
mad_raven
Hi Darph

The problem as i see it lies with the following bit of code.

CODE
<input type=\"hidden\" name=\"maxt1\" size=\"40\">
<input type=\"hidden\" name=\"maxt2\" size=\"40\">
<input type=\"hidden\" name=\"maxt3\" size=\"40\">


although you have set the variables you haven't actually given them a value so you should change the above to something like below.

CODE
<input type=\"hidden\" name=\"maxt1\" size=\"40\" value=\"1\">
<input type=\"hidden\" name=\"maxt2\" size=\"40\" value=\"2\">
<input type=\"hidden\" name=\"maxt3\" size=\"40\" value=\"3\">


By adding the value attribute to the input tag you are giving the variables a value so when you echo the variables using the code in the other file you will get the following.

CODE
123



Hope that helps
darph
thx for help

i got the misstake i have used

['var']
but i have to use
["var"]

so long

darph
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.