Saturday, 15 February 2014

Perform php commands when button is clicked html -



Perform php commands when button is clicked html -

how 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 form , submit need values of php variables , don't want lose them when move pages.

the total code is:

<title>legendmaker - 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 `storycodes` `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 info found. please check serial code ensure have not incorrectly entered it. if code right please email website administrator farther 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 have have take care of involving file php because want create files not web accesible come in serial code previous form access it.

no, cant work. php server side language, html not. if don't want submit form can utilize ajax purpose, not asked. either submit form send info php or utilize javascript, ajax notably.

php html forms post button

No comments:

Post a Comment