PDA

View Full Version : How to grab values from a text field or selected radio button field


baktec
04-13-2005, 09:18 PM
Hi Friends

Look at this code

<input type='text' name='user_name'>

See i want to get the value enterded at this textfield to a PHP variable, which is in the same page

Help me..

Thanks

NancyJ
04-13-2005, 09:32 PM
if (isset($submit))
{
$username = $_POST['user_name'];
echo "$username";
}
else
{
<form action = "" method = "POST">
<input type='text' name='user_name'>
<input type = "Submit" value ="Submit" name = "Submit">
}

baktec
04-13-2005, 09:39 PM
Going to check it ...
Thanks NancyJ

rlemon
04-13-2005, 09:50 PM
for checkbox values it's something like this:


if(isset($HTTP_POST_VARS['checkboxName'])){
$checkboxVals = $HTTP_POST_VARS['checkboxName'];
foreach ($checkboxVals as $cbox){
echo "$cbox was selected<br>";
}
}


and the form would look like this:

<form>
<input type='checkbox' border='0' name='checkboxName[]' value='someValue1'><br>
<input type='checkbox' border='0' name='checkboxName[]' value='someValue2'><br>
<input type='checkbox' border='0' name='checkboxName[]' value='someValue3'>
</form>

baktec
04-14-2005, 07:50 AM
Thanks rlemon ...

I have one more problem rlemon . . .

Plz check this topic ...

http://www.codingforums.com/showthread.php?t=56898

Thanks again