[PHP] Help with POSTing variable array names from a PHP script please.

2003-02-15 Thread Michael Eacott
I'm attempting to "print" to the client's browser a list of book titles 
found in a MYSqL table, each with a checkbox on its "printed" line so 
that the client can click on the checkboxes to retrieve selected books.

The php script below is included after verification of the fields in an 
HTML form.
Global variable $books is the name of the books table in the connected 
database.  
Variable $title contains the string to be used to search for matching 
book titles in the books table of the library.

I was hoping that the checkboxes printed would have different array 
indexes when script "booksretrieve" is posted.

There must be a much better way than the following old mainframe style 
of scripting I've done.

After the php scripts there is a sample of what was "printed" by the 
client browser.

Help please.

Mike



# Show details of BOOKS

# Performing SQL query

$query = "SELECT * FROM `$books` WHERE `title` LIKE '$title' LIMIT 99";
$result = mysql_query($query) or die("Query failed");

$count = 1; $bookslist = "";
while ($rowarray = mysql_fetch_array($result, MYSQL_ASSOC))
{
   $booksid = $rowarray["booksid"];
   $title = $rowarray["title"];
   print '';
   print '';
   print '';
   print '';
   print 'Library Search results';
   print '';
   ## NOTE php script to run 
#
   print '';
   print '';
    $bookslist to be used by ###
   if ($bookslist == "") $bookslist = $booksid;
   else $bookslist = $bookslist. ",". $booksid;
   print "Book number: $booksid in bookslist $bookslist .";
   print 'Click box get  following book retrieved. ';
   print "";
   print "title:. " .$title. " ";
   print "-";
   $count = $count + 1;
}
# Free resultset */
mysql_free_result($result);

print "Click 'Clear all fields' if you do NOT want us to do 
this. ";
print '  ';
print "";
print "";

return;
?>


#
#BOOKSRETRIEVE : Retrieve library books selected by clicked checkboxes.
#

echo "BOOKSRETRIEVE. Array contents print as:";
$result = $_POST['book'];
print_r($result);

return;
?>

Sample of what was "printed" by the client browser (checkboxes shown as #):


Book number: 0 in bookslist 0 .

Click box get following book retrieved. #

title:. Book title A

-

Book number: 3 in bookslist 0,3 .

Click box get following book retrieved. #

title:. Book title C

- 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Recursion????? A message for Alex Davis

2003-02-15 Thread Michael Eacott
Alex

Like you I have php scripts that validate the contents of registration 
and other forms. I'm new to php and do not have a clue about client side 
(java) scripting. Yes and the GO BACK AND TRY AGAIN process is what my 
php scripts do. All very messy. I'll have to learn javascript but 
currently I have a deadline to meet with the php implementation.Be 
interested to see sometime in the future the javascripts you write to 
validate you forms.

Regards

Mike Eacott

rentAweek Ltd
http://www.rentaweek.org


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Text data truncated after first blank character in form fields

2003-02-17 Thread Michael Eacott
When I have the following in a form:

>
the value shown in the form field is   a and not a b c
why?
and how can I get to see the untrucated text, please?

Mike


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php