473,395 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Space Issue with my PHP page

MS
I am a newbie to PHP so hopefully this is a easy question.

I am pulling data off of one server, which holds our data base and
posts it to my PHP page.

I have the following code on my php page:
$pfirstname = $_POST['NFIRST0'];
$plastname = $_POST['NLAST0'];
$paddress = $_POST['NSTREET0'];
$pxaddress = $_POST['NEXTRAADDRESS0']; etc....

For the $paddress variable, it is skipping anything after a space. For
example, if the address is 1234 Main, the only data that pulls in to my
php page would be 1234. It would skip the Main. This is also occuring
with other variables as well.

Anyone have any ideas to why this is happening?

May 16 '06 #1
9 4483
Can you supply more code so I can see see what your script is doing?
How are you pulling the data off of the server?

May 16 '06 #2
tim

MS wrote:
I am a newbie to PHP so hopefully this is a easy question.

I am pulling data off of one server, which holds our data base and
posts it to my PHP page.

I have the following code on my php page:
$pfirstname = $_POST['NFIRST0'];
$plastname = $_POST['NLAST0'];
$paddress = $_POST['NSTREET0'];
$pxaddress = $_POST['NEXTRAADDRESS0']; etc....

For the $paddress variable, it is skipping anything after a space. For
example, if the address is 1234 Main, the only data that pulls in to my
php page would be 1234. It would skip the Main. This is also occuring
with other variables as well.

Anyone have any ideas to why this is happening?


Hi there

How are you delivering the data to your page?

It could be because spaces in post data need to be converted to
pluses(+) or %32 before delivery

If you are using php to send the data to the php page then use the
urlencode function on the data before you post it
http://uk.php.net/urlencode

Tim

May 16 '06 #3
Rik
MS wrote:
I am a newbie to PHP so hopefully this is a easy question.

I am pulling data off of one server, which holds our data base and
posts it to my PHP page.

I have the following code on my php page:
$pfirstname = $_POST['NFIRST0'];
$plastname = $_POST['NLAST0'];
$paddress = $_POST['NSTREET0'];
$pxaddress = $_POST['NEXTRAADDRESS0']; etc....

For the $paddress variable, it is skipping anything after a space.
For example, if the address is 1234 Main, the only data that pulls in
to my php page would be 1234. It would skip the Main. This is also
occuring with other variables as well.

Anyone have any ideas to why this is happening?


I'd think the posting goes wrong, have you got a snippet of code from that
side?

What does print_r($_POST); say?

If $_POST['NSTREET0'] does have to right value, are you sure not casting
$paddress to an integer somewhere?

Grtz,
--
Rik Wasmus
May 16 '06 #4
ms*****@gmail.com says...
For the $paddress variable, it is skipping anything after a space. For
example, if the address is 1234 Main, the only data that pulls in to my
php page would be 1234. It would skip the Main. This is also occuring
with other variables as well.

Anyone have any ideas to why this is happening?


Yes, It's a HTML issue not a PHP one. You need to double-quote any
strings with spaces in your inputs.

Example:
echo "<input type=hidden name=paddress value=$paddress>";
should be changed to
echo "<input type=hidden name=paddress value=/"$paddress/">";
or
echo '<input type=hidden name=paddress value="$paddress">';

GM
May 16 '06 #5
Rik
Hmmmz, it's getting late for you I think....

Geoff Muldoon wrote:
Example:
echo "<input type=hidden name=paddress value=$paddress>";
should be changed to
echo "<input type=hidden name=paddress value=/"$paddress/">";
You mean:
echo "<input type=hidden name=paddress value=\"$paddress\">";
echo '<input type=hidden name=paddress value="$paddress">';


You mean:
echo '<input type=hidden name=paddress value="'.$paddress.'">';
or:
echo "<input type=hidden name=paddress value='$paddress'>";

And now we're busy. just as well put quotes around hidden: couldn't hurt,
and it's a good habit to quote all the attribute-values regardless wether it
is really necessary or not.

Grtz,
--
Rik Wasmus
May 17 '06 #6
In article <e4**********@netlx020.civ.utwente.nl>,
lu************@hotmail.com says...
Hmmmz, it's getting late for you I think....

Geoff Muldoon wrote:
Example:
echo "<input type=hidden name=paddress value=$paddress>";
should be changed to
echo "<input type=hidden name=paddress value=/"$paddress/">";


You mean:
echo "<input type=hidden name=paddress value=\"$paddress\">";
echo '<input type=hidden name=paddress value="$paddress">';


You mean:
echo '<input type=hidden name=paddress value="'.$paddress.'">';
or:
echo "<input type=hidden name=paddress value='$paddress'>";

And now we're busy. just as well put quotes around hidden: couldn't hurt,
and it's a good habit to quote all the attribute-values regardless wether it
is really necessary or not.


Oops, not enough coffee, thanks for the corrections.
May 17 '06 #7
tim wrote:
It could be because spaces in post data need to be converted to
pluses(+) or %32 before delivery


%20, not %32.

<?php
print urldecode('%32'); // prints '2'.
?>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

May 17 '06 #8
tim

Toby Inkster wrote:
tim wrote:
It could be because spaces in post data need to be converted to
pluses(+) or %32 before delivery


%20, not %32.

<?php
print urldecode('%32'); // prints '2'.
?>


Oops I forgot to convert to hex, thank you for the reminder.

Tim

May 17 '06 #9
MS
Thanks for all the postings, I got it working.

May 23 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Jayaseelan | last post by:
Hi, Received the following error during index creation of the tables. The data & log files are set to 'unrestricted growth' and enough space available on the disk. Any reasons? ___________...
2
by: stephenvoss | last post by:
I'm currently redesigning my site and have noticed a weird issue w/ IE6. Basically, it's adding too much vertical space between elements. Here's the front page:...
27
by: Aurangzeb M. Agha | last post by:
I'm running Postgres 7.1.3, and just started having a problem where my dynamic site is going down (read-only DB, with no writes happening to the DB) regularly (every other day). I have no idea...
6
by: DH | last post by:
I have a VERY basic question about figuring database size. I've inherited a database which is generally similar to this basic one: Item, Red, Blue, Green, Yellow (text), (int),(int),(int),(int)...
0
by: Rod Billett | last post by:
The included html contains 3 divs. One primary Div, with 2 nested divs. the second nested DIV contains an empty table. Problem 1: Phantom Space. When viewed within the browser, the div 'action...
10
by: Angel | last post by:
I want to concat a space in an HTML Control's innerText property. here is a sample code Dim celCreate As New HtmlControls.HtmlTableCell() celCreate.innerText = " TEST" When the page is...
5
by: Stu Carter | last post by:
Hi, ENV: Windows 2003 Server SP1 (+all updates), VS 2003, .Net 1.1 SP1 We've got an ASP.Net web application using State Service. All is fine until we tried to use the app through a virtual...
5
by: dw | last post by:
hello - first, let me state that i am an Asp.Net rookie. here is the situation: i have a page that looks good in the vs.net designer, but when the page renders there are extra amounts...
8
by: maroger | last post by:
I'm sure this is a common issue, but I haven't come across anything that works for me thusfar. I am trying to fix my header, which works fine in firefox but has extra space in IE. Here are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.