<a style="text-align:center!important;" href="ClientData\out_ResumeParserReport\202321_Resume_Parsing.csv" class="btn btn-primary" download>Download</a>
after pasting the above code the csv file is downloading.
$fileName = date("Ynj")."_Resume_Parsing.csv";
<a style="text-align:center!important;" href="ClientData\out_ResumeParserReport\<?php $filename ?>" class="btn btn-primary" download>Download</a>
but after passing the variable i'm getting the webpage instead of csv file. please refer the image belaow-
Related
html:
<button type="button" class="btn btn-outline-danger btn-icon-text" id = "LOAD">
<i class="mdi mdi-upload btn-icon-prepend"></i>LOAD
</button>
php:
<?php
if (isset($_SESSION['LOAD']))
{
exit();
}
?>
when i click the button, nothing happens. sorry i am really new to html and php. i have tried multiple other methods but none work :(
<button type="button" class="btn btn-outline-danger btn-icon-text" id = "LOAD">
<i class="mdi mdi-upload btn-icon-prepend"></i>LOAD
</button>
That's just a HTML code, so it will not trigger anything. You need little bit javascript.
Also remember, php loads before javascript. So you can't trigger php with javascript if you don't use AJAX or redirect etc.
<script>
document.getElementById("LOAD").onclick = function(){
window.location.href = window.location.href+"?LOAD=1";
}
</script>
If you add that javascript code, button will refresh the page and redirect the same page with GET parameter.
You can control the GET parameter on the PHP side.
<?php
if (isset($_GET['LOAD']))
{
exit();
}
?>
It's not efficient path but if you understand the mechanics, you can figure it out.
Research AJAX.
You are not assigning the button name (which is different from the id)
try name="LOAD" as in:
<button type="button" class="btn btn-outline-danger btn-icon-text" id="LOAD" name="LOAD">
<i class="mdi mdi-upload btn-icon-prepend"></i>LOAD
</button>
</div>
I making an application that allows users to upload a file in a directory. the if user want to change file(uploaded file is wrong document) user can overwrite it with new file.
For example user uploaded id card with with wrong file, then user can change the file with correct file by clicking a button.
Code:
HTML
<form method="post">
<input class="form-control white_bg" id="allfile" name="allFile" type="file" required><br>
<button type="submit" name="save" class="btn btn-info btn-min-width mr-1 mb-1"">Save</button>
</form>
PHP
$file = $_FILES["allfile"]["tmp_name"];
$name = $fileName;
$extensionPhoto = substr($photo,strlen($photo)-4,strlen($photo));
$allowed_extensions = array(".jpg","jpeg",".png",".gif",".pdf",".PDF");
$file1 = $fileName;
move_uploaded_file($_FILES[$file],"userdocs/".$file1);
Check if the file already exists. Delete it and move the new file
if(file_exists("userdocs/".$file1)) {
unlink("userdocs/".$file1);
move_uploaded_file($_FILES[$file],"userdocs/".$file1);
}
today I need help for this form. It will save data in a vcard, in .vcf format and this form is in a html page and i can't submit to another page. So now, if I click the save button, it download properly in .vcf extension but in the file there is the entire html page... I need to download only the vcard, and im using a class retrived from here https://github.com/facine/vCard/blob/master/vCard.class.php.
Maybe with simple_html_dom.php I can extract the div that i need...
Thanks for help!
<form method="post" action="#">
<button name="btn_func" class="btn waves-effect waves-light red">
<span class="white-text">Salva nella rubrica</i></span>
</button>
<div id="savecard">
<?php
include('simple_html_dom.php');
include('vcard.php');
$card = new vCard();
$card->setnew("first_name", $params['user']->first_name);
$card->setnew("last_name", $params['user']->last_name);
$card->setnew("birthdate", $params['user']->birthdate);
$card->setnew("home_address", $params['user']->address);
if(isset($_POST['btn_func'])){
$card->download();
}
?>
</div></form>
Just Add header to your PHP Code.
<form method="post" action="#">
<button name="btn_func" class="btn waves-effect waves-light red">
<span class="white-text">Salva nella rubrica</i></span>
</button>
<div id="savecard">
<?php
include('simple_html_dom.php');
include('vcard.php');
$card = new vCard();
$card->setnew("first_name", $params['user']->first_name);
$card->setnew("last_name", $params['user']->last_name);
$card->setnew("birthdate", $params['user']->birthdate);
$card->setnew("home_address", $params['user']->address);
if(isset($_POST['btn_func'])){
header('Content-Type: text/x-vcard');
$card->download();
}
?>
</div></form>
Hope this helps you..
<button onclick="location.href='<?php echo base_url();?>Guesser/guess'">Start!</button>
Just displays an empty web page with about:blank as the url
Try this:
<input type="button" onclick="location.href='<?php echo base_url();?>Guesser/guess'" value="Start!">
my form contain this button and function Redirect() is redirecting to the another page and variable $map_array containing a URL that I am trying to get in another page but its not displaying the value after the ampersand(&) sign.
<a onClick="Redirect();return false;" href="<?php echo $map_array[0][1]['deeplink']; ?>"
style="background-color:#ff8c21;" class="btn btn-warning btn-lg">
Buy Now</a>