Not sure if this is PHP or just basic HTML, but is there some way to show, on a web page, the default file download directory? For example, in Firefox, if you go to Tools->Settings->General and look for 'Downloads: Save files to', can this directory be displayed (as text)? If so, how?
Not sure what is going on, please help me.
I have written a PHP file that generates a CSV file that is drawn from a MySQL database. This works just fine because I used this https://stackoverflow.com/questions/15769732/write-to-php-output-buffer-and-then-download-csv-from-buffer as a guideline.
The problem is this: After the CSV file is downloaded, I want the site to go to another page. Using the code in the reply from DigiLive on 12 Jan 2016 as the basis, after the line
ob_end_flush();
I have the lines
echo "<script type='text/javascript'> document.location = 'OtherPage.php'; </script>";
exit;
These lines work perfectly elsewhere, but here they do nothing. What am I missing?
Yeah, I figured this out. I simply put the upload code inside a if that checks to see if the button was pushed. Sorry to have wasted everyone's time - some more thinking and I figured it out. Thanks.
I have created a simple web site that is used to enter data into a database. Each page essentially has:
<form role="form" method="post"> ... </form>
The site works without issue. However, I want to add to the form the ability to upload an image file. I wrote a small test page that does this and it works without issue. However, the problem is this: The test page has the following:
<form action="fileUploadScript.php" method="post" enctype="multipart/form-data">
The first <form> uses code on the page itself to do the database insertion, whereas the second <form> uses an external php file to upload the file.
In terms of executing the code, I suspect that I could make this work with two mouse clicks: one to upload the file and the other to enter the data. Is there a way to achieve this with one mouse click? Note that there are a dozen fields or so, and identifying all of them to have the external php file handle them might be a pain...
Thanks.
I am beyond confused and am hoping that you can help!
I have a database and one table looks like this:
dbTable {
RowID int(10) unsigned <this value is created automatically>
Str varchar(100)
Val int(10) unsigned
}
In my html/php, I have the following test code:
$sql = "SELECT * FROM dbTable WHERE RowID = 5";
$entityData = $mysqli->query($sql);
$EntityInfo = $entityData->fetch_assoc();
$dStr = $EntityInfo[Str];
$dVal = $EntityInfo[Val];
echo “first line”;
echo "str: " . $dStr;
echo "val: " . $dVal;
$sum = $dVal +5;
echo "sum: " . $sum;
if ($dVal > 0) {
echo "if Val: " . $dVal;
}
The first four echo statements work, however, I cannot get the code to enter the if loop. It seems that the code knows that $dVal is an integer because the sum shown is correct. What must I do to make the if statement work?
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.