Re: php coding help needed
| From: | Doug Semig | Date: | Thu, 22 Jun 2000 00:57:29 +0000 |
| Subject: | Re: php coding help needed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2558@lists.php.net to get a copy of this message | ||
I do hope that your code snippet was part of a larger statement. For
example:
$something = "(your code snippet here) ";
If this is the case, as I sense it is, you've simply created incorrect HTML
in your statement. In an HTML form field such as the one you're creating
with the INPUT tag, you need to enclose a value in quotation marks when
that value may have whitespace in it. You do this in a PHP string with
escaped quotation marks:
$something = "<tr>Address</td><td colspan=5 align=left><input type=text
name=homepostaladdress size=100 maxlength=254 value=\"" .
$attrib[0]["homepostaladdress"][0] . "\"></td>";
The part that will interest you is the escaped quotation marks (\") that I
inserted after the value= and before the ></td>. You seem to have an
aversion to using quotation marks around the values of your attributes, but
when a value may contain a space, the quotation marks are important. The
escaped quotation mark is how to put them in a string in PHP.
http://www.php.net/manual/language.types.string.php
documents this.
By the way, is $attrib really a 3D array? Wow! I extensively used 3D
arrays in my former life as a programmer doing massive statistical
calculations on huge datasets, but I can count on a couple of fingers the
number of times I've needed them since.
Anyway, specifications for HTML, including HTML forms and the SELECT tag,
can be found at http://www.w3.org. There are also extensive HTML
tutorials
and lots of general HTML documentation buried in Netscape's site.
HTH,
Doug
Michael Cunningham was heard at 08:19 PM 6/21/00 -0400 to say:
>
>Hiya,
>
>I am working on modifying a php3 program someone wrote (I am a php
>newbie) and I am having a bit of trouble. It seesm that when
>the array entry that is below contains more then one word
>seperated by a space only the first word prints out when
>building the web page. If I actually look at the real data
>it is all there but it just isnt printing it all in the input field.
>Any ideas? I am sure it is something really simple that i am just
>missing. This is for a ldap interface if you are wondering.
>
><td>Address</td><td colspan=5 align=left><input type=text
>name=homepostaladdress size=100 maxlength=254
>value=" . $attrib[0]["homepostaladdress"][0] . "></td>
>
>Also.. how could I make a selection box? Something with a
>half a dozen choices or so and get the data into this
>value.
>
>Thanks for any help you can offer..
>
>Mike