Reputation: 3
i have a string variable in php where it should fit inside different textbox. is it possible? as an example
<?php
print "UserName Balance 100";
?>
and html form
<html>
<head><title>test Page</title></head>
<body>
<form method="" action="">
username : <input type="text" value="$php value in here" disabled><br>
Balance : <input type="text" value="$php value in here" disabled><br>
Amount : <input type="text" value="$php value in here" disabled>
</form>
as u can see i want to put that string variable into these 3 box The "UserName" goes in first box then "Balance" in second box and then the third one.
just dont know how to do that. :(
Upvotes: 0
Views: 115
Reputation: 5733
Is this what you're asking?
$data ='UserName Balance 100';
$result = explode(" ", $data);
?>
<body>
<form method="" action="">
username : <input type="text" value="<?php echo $result[0]; ?>" disabled><br>
Balance : <input type="text" value="<?php echo $result[1]; ?>" disabled><br>
Amount : <input type="text" value="<?php echo $result[2]; ?>" disabled>
</form>
Upvotes: 2
Reputation: 1502
Try something like this:
echo "username : <input type=\"text\" value=\"$username\" disabled><br>";
echo "Balance : <input type=\"text\" value="\$balance\" disabled><br>";
echo "Amount : <input type=\"text\" value="\$amount\" disabled>";
Upvotes: 1