Fine, fine... ksh, zsh, ash, even fish (which IS a shell) for all I
care... ;)
As to your problem, you need to get the escaping of your titles in sync
before doing this. Coming from the db, the appostrophes are going to be
escaped as "\'" and in the page source, it looks like the ones in the
option tags are \'.
It looks to me like you "HTML-ize" the escaping of $ht AFTER you make
the comparision, while $pTitle. having been posted from the previous
pass, would already have the HTML quote entity.
Did that make any sense?
Cheers,
Vern
Bud Manz wrote:
Yeah, I was just poking fun at Vern. lol, couldn't resist it (obviously) ;o)
On a different note... I have some php code that is giving me fits. The
site resides at http://www.ehymns.org/?page=mens&title=Mens
<http://www.ehymns.org/?page=mens&title=Mens> and it provides
(sometimes) hymn arrangements for users. The problem I am having is the
filenames for the pdfs that are displayed sometimes contain apostrophes
and this does not allow the page to work properly. The affected code
follows:
[code]
<form method="post" name="hymns">
<?php
echo "\n<input type='hidden' name='Book' value='" . $_POST['Book'] .
"'>";
echo "\n<input type='hidden' name='type' value='" . $_POST['type'] .
"'>\n";
$pBook = $_POST['Book'];
$pType = $_POST['type'];
if(isset($_POST['title'])) {
$pTitle = $_POST['title'];
} else {
$pTitle = $_GET['title'];
}
$allowMP3 = $_POST['allowMP3'];
$sql = "select mens.Id, HymnTitle, hymntype.type AS HymnType from
mens inner join hymntype on mens.type = hymntype.Id";
if($pBook == "All" || $pBook == "")
{
if($pType != "")
{
$sql .= " where Type = '" . $pType . "'";
}
}
else
{
$sql .= " where " . $pBook . " = '1'";
if($pType != "")
{
$sql .= " and Type = '" . $pType . "'";
}
}
$sql .= " order by HymnTitle;";
$pArray = $db->doSQL($sql);
$mens_res = $pArray{0};
$mens_count = $pArray{1};
?>
<p align="center">
<table align="center">
<tr>
<td align="right" width="50%"><strong>Select Hymn Title
here: </strong></td>
<td align="left" width="50%"><select name='title'
onchange='submitHymn()'>
<option selected> Select Hymn here ... </option><?php
while ($row = mysql_fetch_array($mens_res)) {
$ht = $row['HymnTitle'];
*if(addslashes($ht) == addslashes($pTitle)) //
This test fails on titles with apostrophes.*
{
echo "\n <option value='" .
htmlspecialchars($ht, ENT_QUOTES) . "' selected>" . $ht . "</option>";
$hnum = $row['Id'];
$hnam = $ht;
$type = $row['HymnType'];
}
else
{
echo "\n <option value='" .
htmlspecialchars($ht, ENT_QUOTES) . "'>" . $ht . "</option>";
}
}
?>
</select><?php // echo '*' . $hnam . '*' . $pTitle. '*' .
htmlspecialchars($ht, ENT_QUOTES) . '*' . htmlspecialchars($pTitle,
ENT_QUOTES); ?></td>
</tr>
<tr>
<td align="right" width="50%"><strong>Allow MP3s (if
available): </strong></td>
<td align="left" width="50%">
<input type="checkbox" name="allowMP3" <?php if($allowMP3 ==
'on') echo "checked" ?>></td>
// more code here...
[/code]
TIA,
Bud
Simón Ruiz wrote:
On Wed, Oct 8, 2008 at 12:38 PM, Bud Manz <[EMAIL PROTECTED]> wrote:
Hey, what about those few brave souls (like me) who still live in the world
of ksh? lol
Bud
I don't believe Vern was being exclusive in citing BASH, so much as
pointing at the most visible example of a shell.
I'd be interested to see what the Korn SHell has to offer, myself.
Simón
------------------------------------------------------------------------
_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
--
This time for sure!
-Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
[EMAIL PROTECTED]; 260-436-0746; FAX: 260-436-5137
_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org