GrayFox12 Posted September 10, 2007 Share Posted September 10, 2007 Hi guys, I wanting to put data from a textfield in a form into a variable which has spaces in it. e.g. $var = 'some data'; but all i get when echoing the variable is 'some' when i want it to display 'some data' as one string. I need this for inserting and retrieving from my mssql database. Plz Help Quote Link to comment Share on other sites More sharing options...
teng84 Posted September 10, 2007 Share Posted September 10, 2007 impossible can you show a bit of your code :-\ Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 10, 2007 Share Posted September 10, 2007 Do you have a set size set for your input field? It may be cutting it off because the variable length is too long. Quote Link to comment Share on other sites More sharing options...
prodigy2k7 Posted September 10, 2007 Share Posted September 10, 2007 Really? I never have problems with this. I just tried it to play around, mine works fine :S test.php <? $var = "hello there"; echo $var; ?> ^works fine I also used single quotes...still worked fine Edit: Oooh, people r responding, kewl, ill shutup now cuz im a noob Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted September 10, 2007 Author Share Posted September 10, 2007 Yea sorry its the size of my input field. How do u change that? Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted September 10, 2007 Author Share Posted September 10, 2007 i change size on my textfield still wont display the full string. When i echoe it outside of textfield it displays full string. What? Quote Link to comment Share on other sites More sharing options...
teng84 Posted September 10, 2007 Share Posted September 10, 2007 show a bit of that code? Quote Link to comment Share on other sites More sharing options...
noidtluom Posted September 10, 2007 Share Posted September 10, 2007 I might not fully understand your question, sorry, but here is my go at answering it: Size? I think you mean maxlength? Size is the width of the input field. Maxlength is the number of characters allowed to be typed in it. Try: <form action='' method='post'> <input type=text name=test maxlength=200> <!-- feel free to change 200 I'm just giving an example --> <input type=submit name=submit value=submit> <!-- and then (if you want action='' on the same page then just do if(submit). --> <?php $myVarTest=$_POST[test]; // I would recommend you run a security function on this variable though. echo $myVarTest; ?> Sorry if my code isn't that neat, it is just a quick example. Quote Link to comment Share on other sites More sharing options...
xyn Posted September 10, 2007 Share Posted September 10, 2007 removing maxlength will not have a limit. 1. can you show your code, then maybe we can see whats wrong. Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted September 12, 2007 Author Share Posted September 12, 2007 <label> Location(Street): <input name="street" type="text" maxlength=200 id="street" value=<?php echo $LocationStreet ?> /> </label> Only shows name 'tas' I want it to display 'tas street'. Quote Link to comment Share on other sites More sharing options...
marcus Posted September 12, 2007 Share Posted September 12, 2007 Just put quotes around the PHP Statement and you should be set. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 12, 2007 Share Posted September 12, 2007 You need quotes around the value, like you have for id, type, name, etc. All of those attributes need to be quoted. Quote Link to comment Share on other sites More sharing options...
GrayFox12 Posted September 12, 2007 Author Share Posted September 12, 2007 Well that was simple. Thankyou for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.