/    Sign up×
Community /Pin to ProfileBookmark

I have a list in a form which is filled form a database.
Some items in the list have white spaces, this is an option example:

“La Manga del Mar Menor”

When I submit the form, what arrives to processing PHP is only “La”, the rest is missing on the way.
I guess I have to use the urlencode in the form:

<option value=<? echo (urlencode($opciones)); ?>>

But I do not know exactly how to decode it in the next page, even though I have been looking at the example in manual.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@YoNJan 27.2004 — I think it's [URL=http://us2.php.net/manual/en/function.urlencode.php]urlencode()[/URL] for the form and [URL=http://us2.php.net/manual/en/function.urldecode.php]urldecode()[/URL] to return to the original value in the next page.

HTH
Copy linkTweet thisAlerts:
@crh3675Jan 27.2004 — First off, you need to quote the value in the option box:

<option value="<? echo($opciones)); ?>">

That is why it is not returning correctly. And NO, you do not need to use urlencode.

Third, you can simplify your code to look as follows:

<option value="<?=$opciones;?>">
Copy linkTweet thisAlerts:
@PerfidusauthorJan 27.2004 — I have put echo between "" and when I look at source code in the website, the "" do not appear:

<option value=La Manga del Mar Menor>La Manga del Mar Menor</option>

I have also echo the variable in the page that processes the form and I only get "La" instead "La Manga del Mar Menor"

Any hints?
Copy linkTweet thisAlerts:
@crh3675Jan 28.2004 — You are doing something wrong because if you use this code:

<option value="<?=$opciones;?>">

I promise you will get the correct results.
Copy linkTweet thisAlerts:
@James1Jan 29.2004 — Hello

Ye he is right

actually writing this way u will get

PHP file--

<option value="<?="Hello World">">Hello</option>
-------------------------------------------


Html-browser(view source)

<option value="Hello World">Hello</option>



[URL=http://www.funspot.com/] Trampoline Pad [/URL]
×

Success!

Help @Perfidus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...