Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Hung Kuen Kung Fu #1
Opening a file from a databse using a form
Forgive me if this is simple but I am stumped. I created a MYSQL database that
contains our newsletters in pdf. On our main page I want to create a jump menu
that allows visitors to choose the newsletter they want to view. I populated
the menu dynamically with the content field from the recordset (the one that
contains the PDF files). Now I am not sure what to place in the action window
of the form. I assume it must be a php file of some sort. Being that is the
case what code do I need in this php file to force the browser to open the
selected pdf file? Thanks.
Darren
Hung Kuen Kung Fu Guest
-
Supspend opening the file after create pdf file from Adobe PDF
Every time I create pdf file, the file opens automatically upon completion. I am using v6.01 Pro. Please advise how to suspend the opening the... -
Data transfer from SQL Server 2000 databse to DB2 databse
SQL Server 2000 database table-data should be transfered to DB2 databse tables. The table formats are same in the two databses. If you have any... -
opening asp file and loading certain text into a form
Hello. Can anyone help me with the following. I have a config.asp file with contains information like: ... -
Bitmaps are displaced when opening FH9 file-I need a test file
Would someone who has reported opening FH 9/10 files in FH MX containing bitmaps that were being displaced please send me a file that displays this... -
Opening a form
I have a table of 260 customers with 30 fields in each record. After building a query based upon that table's relationship with three other tables,... -
Hung Kuen Kung Fu #2
Re: Opening a file from a databse using a form
Is this just not possible?
Darren
Hung Kuen Kung Fu Guest
-
Michael Fesser #3
Re: Opening a file from a databse using a form
.oO(Hung Kuen Kung Fu)
The files are stored in the DB? Why not use plain files and just store>Forgive me if this is simple but I am stumped. I created a MYSQL database that
>contains our newsletters in pdf.
the filenames in the DB?
Yep. It has to be a script that gets the name of the requested>On our main page I want to create a jump menu
>that allows visitors to choose the newsletter they want to view. I populated
>the menu dynamically with the content field from the recordset (the one that
>contains the PDF files). Now I am not sure what to place in the action window
>of the form. I assume it must be a php file of some sort.
newsletter from the submitted form data, fetches the file from the DB
and returns it with correct headers to the browser.
Don't try to force anything. Just deliver the file as if it would have>Being that is the
>case what code do I need in this php file to force the browser to open the
>selected pdf file?
been requested directly and delivered by the server. Use the header()
function to return the correct content type (application/pdf) and the
filename. Then send the file content. Check the header() documentation
for an example code.
[url]http://www.php.net/header[/url]
Micha
Michael Fesser Guest
-
Hung Kuen Kung Fu #4
Re: Opening a file from a databse using a form
I checked out the header information but I am not sure what I am missing.
Plus, for some unknown reason, my menu that I bound the db info too no longer
lists the files. I didn't change anything just didn't know what to add to
complete. Is there anywhere I can look at some code that does a similar
function. I assume I can get the form to send the chosen id to the php page.
Again, just don't know what the heck to put on that php page. Thanks.
Darren
Hung Kuen Kung Fu Guest
-
Michael Fesser #5
Re: Opening a file from a databse using a form
.oO(Hung Kuen Kung Fu)
Can you post an URL and some of the code you already have?>I checked out the header information but I am not sure what I am missing.
>Plus, for some unknown reason, my menu that I bound the db info too no longer
>lists the files. I didn't change anything just didn't know what to add to
>complete.
Yep, it's plain HTML.>I assume I can get the form to send the chosen id to the php page.
Assuming the form is sent using the GET method you'll find the ID of the>Again, just don't know what the heck to put on that php page.
selected newsletter in the $_GET array. Check if a newsletter with this
ID exists in the database, get its content and send it back to the
client.
Micha
Michael Fesser Guest
-
Hung Kuen Kung Fu #6
Re: Opening a file from a databse using a form
I am not experienced enough in hand php coding to put this all together. My
hand coding is limited. I can understand it when I see it and can tweak
another example to what I want but I don't have enough knowledge to do it from
scratch. Most of the dynaic PHP stuff i do I use Dreamweaver's capabilities to
do for me. I assume what I was trying to do was simple but I don't even know
where to start. I will simply have to figure out another wat to draw the
files back out of the database. It sucks being retarded (ha ha). Thanks for
the help. I will post what I have so far. So, if you want check back a bit
later.
Darren
Hung Kuen Kung Fu Guest
-
Hung Kuen Kung Fu #7
Re: Opening a file from a databse using a form
OK,
Here is the code for my search page. Like I said, it once worked but now it
won't even list the files. I chose the content field for both the name and the
value when I was creating the dynamic binding of the menu in the form. I have
absolutely no clue what to put in my results.php page though I did set the
parameters of the link to attach the id filed of the recordset.
Thanks
Darren
<?php require_once('Connections/mlgolf.php'); ?>
<?php
mysql_select_db($database_mlgolf, $mlgolf);
$query_rsnewsletters = "SELECT * FROM upload";
$rsnewsletters = mysql_query($query_rsnewsletters, $mlgolf) or
die(mysql_error());
$row_rsnewsletters = mysql_fetch_assoc($rsnewsletters);
$totalRows_rsnewsletters = mysql_num_rows($rsnewsletters);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" action="results.php?id=<?php echo
$row_rsnewsletters['id']; ?>">
<select name="select">
<?php
do {
?>
<option value="<?php echo $row_rsnewsletters['content']?>"><?php echo
$row_rsnewsletters['content']?></option>
<?php
} while ($row_rsnewsletters = mysql_fetch_assoc($rsnewsletters));
$rows = mysql_num_rows($rsnewsletters);
if($rows > 0) {
mysql_data_seek($rsnewsletters, 0);
$row_rsnewsletters = mysql_fetch_assoc($rsnewsletters);
}
?>
</select>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
<?php
mysql_free_result($rsnewsletters);
?>
Hung Kuen Kung Fu Guest
-
Michael Fesser #8
Re: Opening a file from a databse using a form
.oO(Hung Kuen Kung Fu)
OK.>I am not experienced enough in hand php coding to put this all together. My
>hand coding is limited.
And I always use my own scripts ...>I can understand it when I see it and can tweak
>another example to what I want but I don't have enough knowledge to do it from
>scratch. Most of the dynaic PHP stuff i do I use Dreamweaver's capabilities to
>do for me.
It is quite simple. Maybe I can setup a little example page tomorrow.>I assume what I was trying to do was simple but I don't even know
>where to start.
The only little problem is that the files are stored in the database. In
most cases that's not the best solution for some reasons (performance
etc.) Any chance to change that back to regular files? With plain files
it would be even simpler to let the user download one: You just have to
link to it and don't need any script.
Micha
Michael Fesser Guest
-
Hung Kuen Kung Fu #9
Re: Opening a file from a databse using a form
Well The upload scrpt I used uploads the pdf files to a mysql database. The
reason I di it this way is the folks that are going to be maintaining the site
know very little about web pages and I needed it to be automated in a sense.
That is why I wanted to use the form to dynamically select the choices from the
database so I would not have to manually add new links to the form pull-down
menu. The form doesn't seem to work anymore anyway. Check out my test page
here. I don't know what its doing now!
[url]http://www.meadowlakegolfclub.ca/indexfake.php[/url]
I have the form send the content id through a url to results.php. This is the
only code I put on the results page.
<?php
header('Content-type: application/pdf');
$content = $_GET['content'];
?>
I am sure I am missing somthing because I am not sure what I need to begin
with. Thanks for the continued help. It is really appreciated.
Darren
Hung Kuen Kung Fu Guest



Reply With Quote

