PHP - Working With Documents And Is Php Really The Best Choice?
Hi,
I've been looking around the net and various forums and found that the code below does appear to work and do what I need at a basic level, but I was wondering if there was a quick and easy way to improve this code OR another alternative that would give me similar/better results. I effectively have certain word documents that I want to use as templates for part of a project. So if i were to write a letter I could pull from the DB usual name/address, but also other intelligent information that might be dependant on different DB fields so it could generate different options, ie if they had children it would produce a different sentence?? Obviously my ideal solution would be that the php coding wouldnt need to be touched, but would allow for 'coded options' within the document to be added/removed without causing any issues, maybe some kind of generic coding so at least some content can be re-used for multiple documents ? However, I did have two initial thoughts on how to do some of this - maybe? (be gentle im still a learner!) 1, create an array of somekind and use generic terms for a set range, say 'bookmark1','bookmark2', etc so a user could just tag the original word document knowing they only had to add a new number to the end if they needed to add something new ? 2,read the document contents out -DO STUFF TO IT- load it back into a doc/save. with this method I will have to admit ive not done before so would welcome any extra detailed input or advisory suggestions, ie. ensuring it goes back into the correct format, say there was an image/logo or complicated series or bulleted paragraghs or tables ?? I have initially choosen MS word as many people out there are familiar with this product and is widely used. However, if it means I am able to create something easily and better within some other format or package that will give me what I want but also be compatible with word then im more than happy to go with any suggestions (ie templates initially created within openoffice and merely saved into .DOC format?) <?php //1. Instanciate Word $word = new COM("word.application") or die("Unable to instantiate Word"); //2. specify the MS Word template document (with Bookmark TODAYDATE inside) $template_file = "C:/t.doc"; //3. open the template document $word->Documents->Open($template_file); //4. get the current date MM/DD/YYYY $current_date = date("m/d/Y"); //5. get the bookmark and create a new MS Word Range (to enable text substitution) $bookmarkname = "mytester"; $objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname); $range = $objBookmark->Range; //6. now substitute the bookmark with actual value $range->Text = $current_date; //7. save the template as a new document (c:/reminder_new.doc) $new_file = "c:/reminder_new.doc"; $word->Documents[1]->SaveAs($new_file); //8. free the object $word->Quit(); //$word->Release(); $word = null; ?> Similar TutorialsHey Everyone, I need to have the ability to create PDF/X1A documents. My initial thoughts are it would be easy as i have created PDFs in the past with no hassle. I have been trawling the google and various blogs but with no joy. Does anyone have any experience creating PDF/X1A documents in PHP ? Is it possible ? Regards, -Ben is there a way I can make something like a ticket in pdf format that can have $name or the likes echo in it? if you could help get me started, that would be great! Hi, There is this project 'District Collector Office-Information integration' that computerizes the citizen facility center. In the system citizens can apply for birth certificates,marriage certificate , obtain ration cards among other functionalists online.so far my system can generate birth and marriage certificates but i totally have no idea on how to validate the same.at what conditions is one illegible to obtain a marriage cert?,supposing one has more than one wife?,what limits one from applying for more than one document? when is one illegible to obtain a birth cert.? conditions limiting application of more than one birth cert ? Thanx. Regards cornelius I am trying to write to a document that is open doc format. Are there any libraries that help out with this specifically mailing labels? Hi everyone, I do not know if this is the right place to ask the following, but I know all the php guru's read here. So please take a moment to read and please help point me in the right direction. I have a php website that I am developing, it is a job website, where my problem is that I need to be able to extract text from the following file formats: doc, docx, rtf, txt and maybe pdf. I have googled and done research on this subject, but I do not find any php scripts that can do the job properly. I have found a java app developed by apache that does the text extraction perfectly, called apache tika. (calling it using exec is really a problem, since most hosts don't provide root access.) I need a way to use this with php. If you know of any other method that I can do this, please help and suggest as this is a major bridge that I have to cross very urgently. your help will be much appreciated, thanks Hi, Well I have been working on Php for quite sometime but creating Word Docs is something I am totally new to. I googled about this and found different methods of creating word documents via php. The most promising one that I found involves writing HTML code and inside header, save it as a *.doc file (I know thats not exactly a Word File but what else can be done). Like this, Code: [Select] header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment; Filename=Report.doc"); The whole word document came out perfectly fine, but there was one little problem (later on turned out to be the BIGGEST one) was placing images in the document. All the images were saved on a secure server so like we do in HTML, I used the following line of code, <img src="https://somewebaddress/users.png" /> The word document appeared to be fine for me, but when that document was sent to the client, client was unable to view the images. Now, I guess you all know what my question would be, and that is, is there a way we could somehow make this work. I even tried downloading all the images to disk and giving their path, still in the end, the document only needs to be sent to the client and images do not appear. Please help me in this regards, Thanks in advance to all P.S. Please see the following sample (mini) code of the real thing, real document is a bit toooooooo big and kind of confidential Code: [Select] <?php header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment; Filename=Report.doc"); ?> <html> <head> <title>TCS Monthly Report $month $year</title> </head> <body> <b><h3> Monthly Operational User Statistics</h3></b> <br> The red line is users logged in over the month. The green area is users recently logged in (last few days).<br> <br><img src="https://somewebaddress/users.png" /> </body> </html> I'm storing website files online and each user can upload their own files and admin can upload files for that user specifically. How would I go about making sure nobody else can download their PDF file? Would it be a case of assigning a folder for each user's documents and not allowing access to any other user to that folder?
Thanks in advance.
hello dear folks good evening dear PHP-Freaks,
well i am not sure if this question fits here - in miscellaneous.
but i am pretty sure that many many calc and excel-experts are here in this great forum.
what is aimed:
want to create a calendar - with 365-chunks that are imported into a caleandar form see some ideas where i can import this i posted the example-calc spreassheet that i want to import. note it has got 365 lines - for 365 days of the next year 2015 what needs to be done ; whats needs to be achieved: i need to impoort the example into the calendar form. see some of the examples -.. if i am able to import the texts (of the collumn ) in a writer or word document each line of the calc needs to get on a sheed of the word or writer. i need to know how to arrange this export of calc into the writer document. if i need to explain it more thoroughiy - just let me know! greetings you matze see some examples of calendar templates Blank daily calendar - Templates Daily lesson planner (color, landscape) - Templates note: all i need to know is to be able to export from calc to any word or calc document... see the attached sample below... Attached Files 2015_sample_version_.ods.zip 18.07KB 0 downloads Hello one and all, Just a quick request here, I've written a script that sends an email with an attached file by the user. (docx, txt, pdf, doc, rtf) are the formats I have accepted. At the moment I'm sending them with the following... Code: [Select] $fileatt_type = "application/pdf"; // File Type It works fine with all formats in older email clients, i.e, like yahoo before they updated the layout, but in the newer versions it's specific and if I try to send it this way it is always delivered as a .PDF and doesn't open if it is any of the other formats. It may sound silly but I've searched a fair bit for the other extensions or formats to include instead of the above code (maybe something like application/doc or something) but there doesn't seem to be a list. Can anyone point me in the right direction? Much obliged, PHP the learned. Hello, First post here! I am using a script to store small files into a database. I know it is not highly recommended but this is the only solution I can find in this case. All seems fine when inserting but when retrieving all documents are corrupt. I am working with PHP 5 on Windows server. Part script after upload: (the document is uploaded to the server first and this is working fine) Code: [Select] if (!empty($_FILES)) { $folder = "kenya/docs_temp/";//including last / $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = dirname(__FILE__); $targetPath = substr($targetPath,0,strrpos($targetPath, "uploadify")). $folder; $targetFile = str_replace('\\','/',$targetPath) . $_FILES['Filedata']['name']; $fileName = $_FILES['Filedata']['name']; $tmpName = $_FILES['Filedata']['tmp_name']; $fileSize = $_FILES['Filedata']['size']; $fileType = $_FILES['Filedata']['type']; $conn=odbc_connect('xxx','xxx','xxxx'); $content = file_get_contents($tmpName,true); $content = addslashes($content); if(!get_magic_quotes_gpc()){ $fileName = mysql_real_escape_string($fileName); } $file_info = pathinfo($_FILES['Filedata']['name']); $addDoc = "INSERT INTO tblfiles (file_name,file_type,file_size,file_content,file_extension) VALUES ('".addslashes($fileName)."','".$fileType."','".$fileSize."','".$content."','".$file_info['extension']."')"; odbc_exec($conn,$addDoc); } The the script to retrieve and output to the browser: Code: [Select] $conn=odbc_connect('xxxx','xxx','xxxx'); //get the document $getF = "SELECT * FROM tblfiles WHERE userId = '".$_GET['userId']."' AND fileId = '".$_GET['fileId']."'"; $rsF = odbc_exec($conn,$getF); $size = floor(odbc_result($rsF,'file_size')); $type = odbc_result($rsF,'file_type'); $name = odbc_result($rsF,'file_name'); $content = odbc_result($rsF,'file_content'); ob_end_clean(); header("Content-length: ".$size.""); header("Content-type: ".$type.""); header('Content-Disposition: attachment; filename="'.$name.'"'); echo $content; And finally here is the structure for the table: Code: [Select] CREATE TABLE `tblfiles` ( `fileId` int(11) NOT NULL auto_increment, `userId` int(11) NOT NULL, `file_name` varchar(100) NOT NULL, `file_type` varchar(100) default NULL, `file_size` int(11) default NULL, `file_content` mediumblob, `file_extension` varchar(50) NOT NULL, PRIMARY KEY (`fileId`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; many thanks for any assistance. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353217.0 Hi, I just want to put up a simple page that has an NDA to which someone can either "agree" or "disagree" and then automatically be forwarded to specific pages accordingly (google and yahoo are just there for testing). Problem is that I keep getting and "Undefined Index" for both "agree" and "disagree". What am I doing wrong? Here is my code: Code: [Select] <form id="nda" name="nda" method="post" action=""> <input type="submit" name="agree" value="I agree" /> <input type="submit" name="disagree" value="I disagree" /> </form> <?php if($_POST['agree']){ header("Location: http://www.google.com"); } else if ($_POST['disagree']){ header("Location: http://www.yahoo.com"); } ?> Thanks! Hi Guys, What I'm aiming for is a random choice generator from a list of variables, and when that choice is chosen, it redirects to a new page. Eg. Random Choice Generator spits out "John Smith" -- Browser redirects to "John Smith's" character card. Below I have the PHP script for the random choice (I think, I'm a total PHP noob!), I'm just having trouble with the redirect part. Any light you could shed would be much appreciated! And also, I do believe this code is just for one choice, would I just need to duplicate it x amount of times? Code: [Select] <?php $stats[1] = 0; $stats[2] = 0; $stats[3] = 0; for ($i = 0; $i < 1000; $i++){ $choice = rand(1,3); if (!$i){ echo "First random choice: $choice<BR>\n"; } $stats[$choice]++; } reset($stats); while (list($num, $count) = each($stats)){ echo "$num: $count<BR>\n"; } ?> Thanks, Jack I have had nothing but great luck with these forums and I am hoping that I am not pressing said luck by asking another question. I have a drop down list populated by information in a database: <?php include_once('../other/functions.php'); $con = mysql_connect($hostname, $username, $password) OR DIE ('Unable to connect to database! Please try again later.'); $db = mysql_select_db($dbname, $con); $sql="SELECT owner_id, teamname FROM owners WHERE active = 1 ORDER BY division, teamname"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $id=$row["owner_id"]; $thing=$row["teamname"]; $options.="<OPTION VALUE=\"$id\">".$thing.'</option>'; } mysql_close($con); ?> <SELECT NAME=thing> <OPTION VALUE=0>Choose One <?=$options?> </OPTION> </SELECT> I have a query that will get the information I want into a table: <?php $con = mysql_connect($hostname, $username, $password) OR DIE ('Unable to connect to database! Please try again later.'); $db = mysql_select_db($dbname, $con); $query = "SELECT * FROM standings, owners, divisions WHERE owners.owner_id = standings.owner_id AND owners.division = divisions.division AND standings.owner_id = 1 ORDER BY year"; $result = mysql_query($query); $row = mysql_fetch_array($result); if (!$result) { die('Invalid query: ' . mysql_error()); } mysql_data_seek($result, 0); echo "<table CELLPADDING=5 border =1>"; echo "<tr>"; echo "<th align=center colspan = 2> Team Name </th>"; echo "<th align=center> Team Owner </th>"; echo "<th align=center> Conference </th>"; echo "<th align=center> Division </th>"; echo "</tr>"; echo "<tr>"; echo "<td align=center colspan = 2>".$row['teamname']."</td>"; echo "<td align=center>".$row['firstname']."</td>"; echo "<td align=center>".$row['conference']."</td>"; echo "<td align=center>".$row['division']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th align=center> Year </th>"; echo "<th align=center> Wins </th>"; echo "<th align=center> Losses </th>"; echo "<th align=center> Points For </th>"; echo "<th align=center> Points Against </th>"; echo "</tr>"; $row = mysql_fetch_array($result); while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td align=center>".$row['year']."</td>"; echo "<td align=center>".$row['win']."</td>"; echo "<td align=center>".$row['loss']."</td>"; echo "<td align=center>".$row['points_for']."</td>"; echo "<td align=center>".$row['points_against']."</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> How do I make it so a user can use the drop down list, select a team name, and the query will then display the info?? Thank you very much Greetings, In this form, I am using radio buttons to select various PHP math function results (total, average,both) and it works but was wondering if it is possible to make it multiple choice, that is to say instead of displaying one result at t time when you submit, displaying two or three of the results, depending on how many radio buttons are clicked. Can this be done? Here is the form code <form action="." method="post"> <input type="hidden" name="action" value="process_scores" /> <label>Score 1:</label> <input type="text" name="scores[]" value="<?php echo $scores[0]; ?>"/><br /> <label>Score 2:</label> <input type="text" name="scores[]" value="<?php echo $scores[1]; ?>"/><br /> <label>Score 3:</label> <input type="text" name="scores[]" value="<?php echo $scores[2]; ?>"/><br /> <!-- ADD LOGIC TO DETERMINE WHETHER TO CALCULATE AVERAGE, TOTAL OR BOTH --> <fieldset> <legend> What do you want to calculate?</legend> <p> <input type="radio" name="calculate" value="average" checked="checked" /> Average<br /> <input type="radio" name="calculate" value="total" />Total<br /> <input type="radio" name="calculate" value="both" />Both</p> <p><br /> </p> </fieldset> <br /><br /> <label> </label> <input type="submit" value="Process Scores" /><br /> <label>Scores:</label> <span><?php if (isset($scores_string)) { echo $scores_string; } ?></span><br /> <label>Score Total:</label> <span><?php if (isset($score_total)) { echo $score_total; } ?></span><br /> <label>Average Sco </label> <span><?php if (isset($score_average)) { echo $score_average; } ?></span><br /> </form> and the processing code <?php if (isset($_POST['action'])) { $action = $_POST['action']; } else { $action = 'start_app'; } if (isset($_POST['calculate'])) { $calculate = $_POST['calculate']; } switch ($action) { case 'start_app': $scores = array(); $scores[0] = 70; $scores[1] = 80; $scores[2] = 90; break; case 'process_scores': $scores = $_POST['scores']; // validate the scores $is_valid = true; for ($i = 0; $i < count($scores); $i++) { if (empty($scores[$i]) || !is_numeric($scores[$i])) { $scores_string = 'You must enter three valid numbers for scores.'; $is_valid = false; break; } } if (!$is_valid) { break; } // process the scores $scores_string = ''; $score_total = 0; foreach ($scores as $s) { $scores_string .= $s . '|'; $score_total += $s; } $scores_string = substr($scores_string, 0, strlen($scores_string)-1); // calculate the average $score_average = $score_total / count($scores); // format the total and average switch($calculate) { case 'average': $score_average = number_format($score_average, 2); $score_total = ""; break; case 'total': $score_average = ""; $score_total = number_format($score_total, 2); break; case 'both': $score_total = number_format($score_total, 2); $score_average = number_format($score_average, 2); break; } break; } include 'loop_tester.php'; ?> Hello every body....
I'm creating a simple php project where the user will be able to choose option from dropdown menu and the query will be executed accordingly..
The html form is shown below....
<select name='movie_name'> <option value='ALL'>All</option> <option value='blah'>Blah blah </option> <option value='blah'>Blah blah </option> ... </select> <select name='movie_genre'> <option value='ALL'>All</option> <option value='Horror'>Horror</option> <option value='Anime'>Anime</option> ... </select> <select name='movie_cast'> <option value='ALL'>All</option> <option value='john'>john</option> <option value='Katrina'>Blah blah Katrina</option> ... </select>If the user select "ALL" then, all the resuls will be displayed according to the selected options AND again If the user select "different" options then, all the resuls matcing from the database will be shown... Tha database schema is shown below | id | movie_name| movie_genre | movie_cast | 1 | Hello Brother | Comedy | Salman Khan | 2 | Blah blah | ALL | Blah blah | 3 | ALL | ALL | ALL | 4 | Blah Blah | Blah Blah | ALL * here "ALL" is a specific text which may or may not be present in the rows.... Thank u in advance.... I have a multiple choice search page which asks visitors to select one or more choices before rendering the search results. It only works in items 1+2 are selected, or 1+2+3, or 1+2+3+4, or 1+2+3+4, etc... I want to make it so that any combination of choices work. Example: Items 1+6 or 2+3+5 or 1+4+6 etc... I have four hours to fix it before my client shows up and need help BADLY. Anyone out there who can help? Whoever can help me... you are the best and I will have a special prayer for you tonight. Here is the coding: <?php } else{ if(!empty($_GET['latt']) && !empty($_GET['long'])) { $condition="SELECT ( 3959 * acos( cos( radians( '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians( '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members "; if(!empty($_GET['s'])) { $a=" where and"; } else { $a=" where"; } if($_GET['edoc']!='') { $condition.=$a." edoc= 'yes'"; } if($_GET['esign']!='') { if($_GET['edoc']!='') $condition.=" and esign= 'yes'"; else $condition.=$a." esign= 'yes'"; } if($_GET['laserprinter']!='') { if($_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and laserprinter= 'yes'"; else $condition.=" laserprinter= 'yes'"; } if($_GET['dualtray']!='') { if( $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and dualtray= 'yes'"; else $condition.=" dualtray= 'yes'"; } if($_GET['error_in']!='') { if($_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and error_in= 'yes'"; else $condition.=" error_in= 'yes'"; } if($_GET['bg_checked']!='') { if($_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and bg_checked= 'yes'"; else $condition.=" bg_checked= 'yes'"; } if($_GET['home_insp']!='') { if($_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and home_insp= 'yes'"; else $condition.=" home_insp= 'yes'"; } if($_GET['fingerprint']!='') { if($_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and fingerprint= 'yes'"; else $condition.=" fingerprint= 'yes'"; } if($_GET['hosp_signing']!='') { if($_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and hosp_signing= 'yes'"; else $condition.=" hosp_signing= 'yes'"; } if($_GET['jail_signing']!='') { if($_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and jail_signing= 'yes'"; else $condition.=" jail_signing= 'yes'"; } if($_GET['im_docs']!='') { if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and im_docs= 'yes'"; else $condition.=" im_docs= 'yes'"; } if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='' || $_GET['im_docs']!='') { $condition.=" and status=1 order by distance asc"; } else { $condition.=$a." status=1 order by distance asc"; } $sql=mysql_query($condition); $num=mysql_num_rows($sql); $getmile=explode(' ',$_GET['miles']); $c=0; while($getidres=mysql_fetch_array($sql)) { if($getidres['distance']<=$getmile[0]) { if($getidres['membership']=='premium') { $prefirst[$getidres['id']]=$getidres['distance']; $c++; } else { $basicfirst[$getidres['id']]=$getidres['distance']; $c++; } } } if(!empty($sql)) { if($c!=0) { if(!empty($prefirst) || !empty($basicfirst)) { ?> I am pretty new to using php and mysql and am struggling to understand how to go about processing a multiple choice quiz script to check if the answer given by the user is right or wrong and give the user the final result . I understand how to write and process register pages and login scripts and the like but for some reason I just can't understand what i need to do for this type of script So far my thinking has been 1) When the page is submitted have a query that compares the answer selected to the answer in the database. 2) Have php variables for correct and and incorrect both initialised to 0 and which will change depending on the answers given. 3) Use an if else statement similar to the code below to add up the score : - if($result['answer']==$_POST[$result['id']]){ $correct_answer++; }else{ $incorrect_answer++; } 4) Have a query that enters the person taking the quiz's grade in to the database. I would really appreciate it someone could give me some guidance for the best way to do this. I have included below my code for selecting the questions form the database. <?php // Starts the session session_start(); /* */ if (!isset($_SESSION['user_level']) or ($_SESSION['user_level'] != 0)) { header("Location: error_page.php"); exit(); } ?> <?php require_once ('mysqli_connect.php'); $email_address = ['email_address']; $quizGradeBegan=("INSERT INTO learner_grade_db( email_address, score, )VALUES ('$email_address',0) "); $result=@mysqli_query($dbcon, $submittedAnswerQuery); if(isset($_SESSION['email_address'])){ ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Q-Quiz: Learner Homepage</title> <link rel="stylesheet" href="sdnt.css" /> </head> <body> <div class="wrapper"> <!-- Start of wrapper div --> <div class="header"> <!-- Start of header div --> <h1>e-Quiz: <br> Learner Homepage</h1> <?php //Makes a call to includes/leaner_nav.php in order to show The Learner Navigation Bar require_once("includes/learner_nav.php"); //Makes a call to includes/welcome_name.php in order to show the Learners name. require_once("includes/welcome_name.php"); /*Makes a call to includes/current_date in order to shows the current date. Will appear in the Day Month Year Format.*/ require_once("includes/current_date.php"); ?> <!-- Shows the Change text size images --> <div id="textSizer"><!-- Start of the textSizer div --> <img id="smallStyler" class="textSize" src="imgs/fontSmall.jpg" height="18" width="18" alt="Smallest" /> <img id="mediumStyler" class="textSize" src="imgs/fontMedium.jpg" height="18" width="18" alt="Default" /> <img id="largeStyler" class="textSize" src="imgs/fontLarge.jpg" height="18" width="18" alt="Biggest" /> </div> <!-- End of textsizer div --> </div><!-- End of Header div --> <div class="article"> <!-- Start of the article div --> <?php $query=("SELECT question_id, question, distractor_1, distractor_2, distractor_3, distractor_4 FROM multiplechoice_db ORDER BY RAND() LIMIT 3 " ); $result = @mysqli_query ($dbcon, $query); // Run the query. while($row = mysqli_fetch_array($result, MYSQL_BOTH)):?> <br> <form action="gradepage.php" method="post"> <?php echo $row['question_id'];?> <br> <?php echo $row['question'];?> <br> <input type="radio" value="1" id=' distractor <?php echo $row['question_id'];?>' name ='<?php echo $row['question_id'];?>'/><?php echo $row['distractor_1'];?> <br> <input type="radio" value="2" id=' distractor <?php echo $row['question_id'];?>' name ='<?php echo $row['question_id'];?>'/><?php echo $row['distractor_2'];?> <br> <input type="radio" value="3" id=' distractor <?php echo $row['question_id'];?>' name ='<?php echo $row['question_id'];?>'/><?php echo $row['distractor_3'];?> <br> <input type="radio" value="4" id=' distractor <?php echo $row['question_id'];?>' name ='<?php echo $row['question_id'];?>'/><?php echo $row['distractor_4'];?> <br> <?php endwhile;?> <p> <input id="submit" type="submit" name="submit" value="Click To Submit Completed Quiz "></> </div> <!-- End of the article div --> <div class="aside"> <!-- Start of the aside div --> <ul class="nav2"> <?php //Makes a call to includes/leanersidebar1.php in order to show The Learner Sidebar require_once("includes/learnersidebar1.php"); ?> </ul> <br><br><br><br><br> </div> <!-- End of the aside div --> <div class="footer "><!-- Start of the footer div --> <?php //Makes a call to includes/footer.php in order to show the Footer require_once("includes/footer.php"); ?> </div><!-- End of the footer div --> </div><!-- End of the wrapper div --> </body> <html> |