ADR3 Posted September 6, 2006 Share Posted September 6, 2006 I am very new to all this I have been struggling to work out or find anyway to display variables in a text box once declared. Could someone please edit the code below to achieve such a simple thing.thanks alotADR3echo "Logged In As: ".$Username; Link to comment https://forums.phpfreaks.com/topic/19911-displaying-variables-in-a-text-box/ Share on other sites More sharing options...
wildteen88 Posted September 6, 2006 Share Posted September 6, 2006 You mean this code:[code=php:0]echo "Logged In As: ".$Username;[/code]Thats fine. Whats wrong with it. Link to comment https://forums.phpfreaks.com/topic/19911-displaying-variables-in-a-text-box/#findComment-87198 Share on other sites More sharing options...
ADR3 Posted September 6, 2006 Author Share Posted September 6, 2006 That only echos it to the top left corner of page - how do you display the variable value in a text box which (which could be anywhere on page or in layer etc)thanks againADR3 Link to comment https://forums.phpfreaks.com/topic/19911-displaying-variables-in-a-text-box/#findComment-87214 Share on other sites More sharing options...
pikemsu28 Posted September 6, 2006 Share Posted September 6, 2006 I could be all wrong but i think you are wanting to display the variable in the Text field box, which can be accomplished like this:[code]<?php $name = 'TESTING'; ?><form id="form1" name="form1" method="post" action=""> <label>Logged in as: <input type="text" name="textfield" value="<?php echo $name; ?>"/> </label></form>[/code]this will display the variable $name in the text box. If this isn't what you are looking for.....sorry! Link to comment https://forums.phpfreaks.com/topic/19911-displaying-variables-in-a-text-box/#findComment-87216 Share on other sites More sharing options...
garces Posted September 8, 2006 Share Posted September 8, 2006 // I think you have to create a file which willl be your page form/*save this as [b]input.html[/b] */<form method="post" action="display.php"> <label>Logged in as: <input type="text" name="username" value="<?php echo $name; ?>"/> </label></form>//then create another file and save as display.php which will be your script<?php $username=$_POST['username']; echo "Logged In as ".$username;?> Link to comment https://forums.phpfreaks.com/topic/19911-displaying-variables-in-a-text-box/#findComment-88274 Share on other sites More sharing options...
ADR3 Posted September 8, 2006 Author Share Posted September 8, 2006 thanks guys for the help - it now half works which is better than what it was - im pretty sure i can go on from herethanks againADR3 Link to comment https://forums.phpfreaks.com/topic/19911-displaying-variables-in-a-text-box/#findComment-88311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.