0

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. :(

0

2 Answers 2

2

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>
Sign up to request clarification or add additional context in comments.

1 Comment

Thank u very much, i lova ya man. it's working :P thx to u all.
1

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>"; 

3 Comments

it's not like that. the print "some string text"; this is just a string and i want to put it into three different box using any split.
$content = "some text here"; in html form i want those 3 word in three box
If the strings are constant, you don't need PHP at all. Otherwise, see SpencerX's answer... and if SpencerX's answer helps you, don't forget to accept it as correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.