473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to use htmlspecialchars in the form - help

Newbie question I guess. Please show me how to use the htmlspecialchars
function in the form below, Thanks:

<form action="formtest1.php?c=1" method=POST>
<b>Find Results with:
These words: <input type="text" length=40 name="keywords">
input type="submit" value="Search">
</form>

Jul 17 '05 #1
1 4208
.oO(leegold2)
Newbie question I guess. Please show me how to use the htmlspecialchars
function in the form below, Thanks:
You only need it when you print out the previously entered informations
again, which is not the case with your form (no default value for the
input field).

Usually the code would look like this:

<input name="foo" value="<?php print htmlspecialchars($foo)?>">

where $foo contains the value that was entered in the text field before.
<form action="formtest1.php?c=1" method=POST>
<b>Find Results with:
These words: <input type="text" length=40 name="keywords">
input type="submit" value="Search">
</form>


You could also try this:

<form action="formtest1.php?c=1" method="post">
<label for="keywords">Find results with these words:</label>
<input name="keywords" id="keywords" length="40">
<input type="submit" value="Search">
</form>

Labels make forms more accessible, especially when used for checkboxes
and radio buttons.

Micha
Jul 17 '05 #2

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

Similar topics

2
8018
by: Phil Powell | last post by:
If $val is the following: ....Just revamped the site's Content Management Application I built.. so do bear in mind.. sorry! Phil stripslashes(htmlspecialchars($val)) should produce the...
3
2308
by: SoulSniper | last post by:
I'm working on a modification to a popular blog script, the modification is for putting source code into a post for the world to see. The idea is exactly the same as putting code into a post on a...
1
2254
by: brianj | last post by:
Running php 4.3.6 on winxp machine I have following code: ----------------------------------------------------------------------- Restaurants <select size='1' name='restaurants'> <? while (...
2
1844
by: universalbitmapper | last post by:
Hi, $new = htmlspecialchars("<a href=", ENT_QUOTES, 'ISO-8859-15'); echo $new; displays: <a href Instead of :
1
2117
by: Software Engineer | last post by:
Testing htmlspecialchars() PHP Function - Converting HTML Characters http://sqa.fyicenter.com/Online_Test_Tools/Test_htmlspecialchars_PHP_Function.php When data needs to be presented in Web...
3
2889
by: DavidPr | last post by:
I have this when posting to a database: $a = htmlspecialchars($_POST); $a = addslashes($a); I have this when displaying the data on a Web page:...
3
3221
by: DavidPr | last post by:
I'm using this: <?php if (isset($_POST)) { $city = htmlspecialchars($_POST); if (!get_magic_quotes_gpc()) { $city = addslashes($city);
14
9468
by: Jeigh | last post by:
Hello, I've created a form where users of my site can contact each other, when I'm processing the data I use: $message = nl2br(htmlspecialchars($_POST)); For example.
8
7878
by: mijn naam | last post by:
Can someone please explain to me why/when one would use htmlspecialchars instead of htmlentities? I know: if you only want to get certain characters translated. This is not the answer I'm...
0
7083
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
7278
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,...
1
6988
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
7456
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...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.