Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9261911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T13:14:09+00:00 2026-06-18T13:14:09+00:00

How would I do something like this that works? <input name=downvid2 type=button id=downvid2 onclick=

  • 0

How would I do something like this that works?

<input name="downvid2" type="button" id="downvid2" onclick="
  <?php
header('Content-disposition: attachment; filename=file.pdf');
header('Content-type: application/pdf');
readfile('file.pdf');
?>" value="Download Story" />

The thing is I would do a form and submit but I need the values of some PHP variables and I don’t want to lose them when I move pages.

The full code is:

<title>Legendmaker - Your Legendmaker Adventure Starring You:</title>

<?php
if( $_POST )
{
$username="***";
$password="*****";
    $con = mysqli_connect("storycodes.db.10339998.hostedresource.com",$username,$password);

    if (!$con)
    {
        die('Could not connect: ' . mysqli_error());
    }

    mysqli_select_db($con, "storycodes");

$code = $_POST['codeInput'];
$code = mysqli_escape_string($con, htmlspecialchars($code)); //May not acually need htmlspecialchars
$query = "SELECT story,video FROM `storycodes` WHERE `code` = '$code'";
$result = mysqli_query($con, $query);

  if (mysqli_num_rows($result)) 
  {
    $row = mysqli_fetch_assoc($result);
    mysqli_free_result($result); 
    extract($row);
    echo $story . $video;   


  }
   else 
  {
   echo "No Data Found. Please check your serial code to ensure that you have not incorrectly entered it. If the code is correct please email the website administrator for further assistance";
  }     

mysqli_close($con);
}
?>
<div align="center">
  <p><span class="linkText"><a href="/index.html">Home</a> <a href="/contact-us.php">Contact Us</a> <a href="/payments.html">Products</a><a href="/products.html"></a></span> </p>
  <p>&nbsp;</p>
  <h2 class="headingText"><img alt="legendmaker - makes legends: banner" width="728" height="90" /></h2>
  <h2 class="headingText">&nbsp;</h2>
  <h2 class="headingText">Your story</h2>
</div>
<p>&nbsp;</p>

  <label>
  <input type="button" name="downvid" id="downvid" value="Download Video" />
  </label>
  <input name="downvid2" type="button" id="downvid2" onclick="
  <?php
header('Content-disposition: attachment; filename=file.pdf');
header('Content-type: application/pdf');
readfile('file.pdf');
?>" value="Download Story" />

I think I have to have it take care of everything involving the file PHP because I want to make the files not web accesible so that only those who enter a serial code into the previous form could access it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T13:14:10+00:00Added an answer on June 18, 2026 at 1:14 pm

    No, it cant work. PHP is a server side language, which HTML is not. If you don’t want to submit a form then you can use AJAX for that purpose, but not like you asked. Either you submit your form to send data to PHP or use JavaScript, AJAX notably.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I need is something like this: /<[\w\d]+ ([\w\d]+\=[w\d])+\/>/ Something that would match several
This is something that I solved using reflection, but would like to see how
In PHP, to create a new object you would do something like this, $dog
If this was PHP, I would probably do something like this: function no_more_half_widths($string){ $foo
I have an html form that looks something like this: <div class=field> <input id=product_name
I would like to do something like this: abstract class Foo { public function
I would like to do something like this in HTML5 where I have something
I would like to recreate something like this if ( arg1 || arg2 ||
I would like to do something like this i.e., use wild card characters in
I would really like to do something like this: Callable<MyObject> myCallable = .... Future<MyObject>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.