Click to See Complete Forum and Search --> : text box name to php variable


horiyochi
01-06-2005, 01:48 AM
hi all..

i've a question...

can php convert textbox name into variable?

example

<input type="text" name="username">
-- post to a page/ convert to
$username

is there a function that capable of doing that?

thanks

ShrineDesigns
01-06-2005, 02:21 AM
try<?php
if(isset($_POST))
{
foreach($_POST as $key => $value)
{
$$key = $value;
}
}
?>

horiyochi
01-06-2005, 02:58 AM
Originally posted by ShrineDesigns
try<?php
if(isset($_POST))
{
foreach($_POST as $key => $value)
{
$$key = $value;
}
}
?>

thanks .. :D

scragar
01-06-2005, 05:52 AM
this may also be done by modifing your config file although you should always back it up before making any changes.

ShrineDesigns
01-06-2005, 01:48 PM
this may also be done by modifing your config file although you should always back it up before making any changes.there are security issues with using register_globals = On, that is why i did not suggest that route, using register_globals should be avoided