PHP - Could Anyone Provide The Php Code For My Idea?
i have a drop-down list of coures from course table.
then i have two text field to enter No of Ques: Allocated Marks: for example: if i select PHP course and enter 4 for No of Ques , 25 for Allocated marks then it should srote in anothe database table like this Course | QuesNo | Marks PHP 1 25 PHP 2 25 PHP 3 25 PHP 4 25 Can anyone help for this code.hope this will not too dificult for you guys. i will really apriciate. Thanks Similar TutorialsHi guys, I have a little issue, I have already got a quiz, here is some of the code from the quiz. Code: [Select] <?php session_start(); session_name("Question_Test"); require_once('questionsandanswers.php'); require_once('functions.php'); if (!isset($_SESSION['questions'])) $_SESSION['questions'] = array(); $id = which_question($_POST['some_field']); $score = 0; if (!isset($_POST['submit'])) { $_SESSION['dclty'] = $_POST['dclty']; if ($_SESSION['dclty'] == "beg") { ?> <script> window.open("extrahelp.php", height=300,width=300); </script> <?php } if ($_SESSION['dclty'] == "int") { ?> <script> window.open("pointers.php", height=300,width=300); </script> <?php } } if (!isset($_POST['submit'])) { $_SESSION['correct'] = array(); $_SESSION['wrong'] = array(); $_SESSION['finished'] = 'no'; if (isset($_SESSION['error'])) { unset($_SESSION['error']); $_SESSION['$num'] = 0; } else { $_SESSION['score'] = $score; $_SESSION['correct'] = array(); $_SESSION['wrong'] = array(); $_SESSION['finished'] = 'no'; $_SESSION['$num'] = 0; } } else { $_SESSION['$num'] = (int) $_POST['num']; $postedanswers = str_replace("_"," ",$_POST['answers']); if ($postedanswers == $answers[$_SESSION['$num']]['0']) { $_SESSION['score'] ++; $_SESSION['correct'][] = $postedanswers; } else { $_SESSION['wrong'][] = $postedanswers; } if ($_SESSION['$num'] < count($questions)-1) { $_SESSION['$num']++; } else { $last = true; $_SESSION['finished'] = 'yes'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Forensics E-learning Package</title> <?php echo $_SESSION['score']; if (!isset($last)) { echo "<script type=\"text/javascript\" src=\"form.js\"></script>"; } ?> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="wrapper"> <div id="header"> <div id="toplinks"> </div> </div> <div id="menu"> <ul> <li><a class="selected" href="home.html">Home</a></li> <li><a href="initialquiz.php">Initial Quiz</a></li> <li><a href="about.php">About</a></li> </ul> </div> <div id="content"> <div id="main"> <h1>Initial Quiz</h1><BR /><BR /> <h1>Protection Section</h1><BR /><BR /> <?php if (!isset($last)){?> <h2>Questions <?php echo $_SESSION['$num']+1; ?>:</h2> <p><strong><?php echo $questions[$_SESSION['$num']]; ?></strong></p> <form id="questionBox" method="post" action="initialquiz.php"> <?php $pattern = ' '; $replace = '_'; $shuffledAnswers = shuffle_assoc($answers[$_SESSION['$num']]); #var_dump($newanswers); foreach ($shuffledAnswers as $answer) { $answer2 = str_replace($pattern,$replace,$answer); echo "<li><input type=\"radio\" id=\"$answer2\" value=\"$answer2\" name=\"answers\" />\n"; echo "<label for=\"$answer2\">$answer</label></li>\n"; } ?> <input type="hidden" name="num" value="<?php echo $_SESSION['$num']; ?>" /> <input type="submit" id="submit" name="submit" value="Submit Answer" /></p> </form><BR /><BR /><b> <?php } else { echo "<p id=\"compare\"><a href=\"detection.php\">Next Section! <img src=\"images/arrow.png\" /></a></p>"; } ?> <?php $_SESSION['$ProtectionPercent'] = number_format(($_SESSION['score'] * 100) / 5); ?> </b> </div> <div id="right"> <h2>Right Menu</h2> <div class="rightitem"> <ul> <li><a class="selected" href="home.html">Home</a></li> <li><a href="initialquiz.php">Initial Quiz</a></li> <li><a href="about.php">About</a></li> </ul> </div> </div> </div> <div class="clearbottom"></div> <div id="footer"> <p id="legal"> </p> </div> </div> </div> </body> </html> The problem is, is that everytime i refresh my page the score counter increments. I have been chatting to a friend and they recommended some coding ideas that may work to stop this, however can any1 help me with a little more on implementing it to my systems? here is the recommended code Code: [Select] session_start(); if (!isset($_SESSION['questions'])) $_SESSION['questions'] = array(); # assuming which_question gives the proper id for the question $id = which_question($_POST['some_field']); # Only handle post data if questions hasn't allready been answered if (!isset($_SESSION['questions'][$id])) { # remove anything other than a-z, A-Z and regular whitespace from answer $answer = preg_replace('#[^a-zA-Z ]#', '', $_POST['answer']); $_SESSION['questions'][$id]['answer'] = $answer; $_SESSION['questions'][$id]['points'] = grade_answer($answer); # ... } Any help would be hugely Appreciated. Thanks Labce Hi guys, When I insert the following code I get the parsing error "unexpected $end": Code: [Select] <?PHP if(isSet($_GET['sid'])) { $con = mysql_connect("localhost","YYYYY", "XXXXX"); if (!$con) {die('Could not connect: ' . mysql_error("oop")); mysql_select_db("YYYYY_testDB") or die(mysql_error()); $totalresult = mysql_query("SELECT * FROM QANDATable"); $num_rows = mysql_num_rows($totalresult); $limit; $counter = 1; while($counter < mysql_num_rows($totalresult)){ $result = mysql_query("SELECT * FROM QANDATable WHERE id = $counter"); $row = mysql_fetch_array($result); echo $row['TSuperQuestion']; if(isSet($_GET['sid'])){ echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";} echo $row['TQuestion']; echo $row['TAnswer']; $counter++;} } else { echo "<h2>Enter Student Number:</h2>"; echo '<form name="input" action="./Code-sandbox.php" method="GET">'; echo '<input type="text" name="sid"/>'; echo '<input type="submit" value="Submit">'; echo '</form>'; } ?> The code worked before I inserted: Code: [Select] if(isSet($_GET['sid'])){ echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";}Any idea what is wrong here? In a nutshell here is what I am wishing to do. The user clicks on a link. The link has an ID# embedded in it. For this example, we will assume that the Link ID (lid) = 4-1-1 Now I have 2 tables: Table 1 Columns: ID | contact_fname | contact_lname 10 Bl4ck Maj1k Table 2 Columns: ID | contact_id | link_id 1 10 4-1-1 I need to display the contact's First and Last name if he is associated with the current link. The way I thought to track that was via table joins. I have attempted a code but it doesnt work. I basically want to make it so whenever Table 1 has a person with an ID equal to the Contact ID of table 2 AND whenever the Link ID in our URL (which I am capturing via a $_GET function and storing in a variable) is equal to the Link ID in our table with the associated contact in it, I want to then display the First Name and Last Name. Below is my failed attempt at this. Weird thing is, I have done this several times before. I don't see myself doing anything different but I must be because it simply doesn't work. Any help would be greatly appreciated... Code: [Select] <?php $link_id = $_GET['lid']; $query = "SELECT table1.id, table1.contact_fname, table1.contact_lname, table2.contact_id, table2.link_id FROM table1, table2 WHERE table1.id = table2.contact_id AND table2.link_id = $link_id"; $sql = mysql_query($query); while($row = mysql_fetch_array($sql)) { $contact_fname = $row['contact_fname ']; $contact_lname = $row['contact_lname ']; echo '' . $contact_fname . ' ' . $contact_lname . '' ; } ?> Please let me know what I am doing wrong here! Thanks boys and girls :-) Bl4ck Maj1k Hi First of all, I know VERY little about PHP, The effort below is a wile guess that has gone wrong. I get this error Parse error: syntax error, unexpected T_IF in /home/repairyo/public_html/shop/includes/content/viewOrders.inc.php on line 57 I have no idea what ive done wrong, may be I am stupid for attempting it. Cheers Paul This is the original code Code: [Select] $view_orders->assign('VAL_STATE',$lang['glob']['orderState_'.$orders[$i]['status']]); This is the modified code Code: [Select] $view_orders->assign('VAL_STATE',$state = $results[$i]['status'] if ($state == '1') { "<font color='#ff9900'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '2') { "<font color='#009900'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '4') { "<font color='#cc0000'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '5') { "<font color='#cc0000'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '6') { "<font color='#cc0000'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '7') { "<font color='#ff9900'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else { $lang['glob']['orderState_'.$orders[$i]['status']]); } Can someone provide me with a good tutorial on how to create really nice looking buttons please. Not just crap ones, like real nice ones. XD Thanks in advance Php Buddies, Line 67: $query = "SELECT page_url,link_anchor_text,page_description,keyphrases,keywords FROM links WHERE $_SESSION['search_column'] = ?"; I get error for the above:
How to fix this ?
Context: <?php //include('error_reporting.php'); ini_set('error_reporting','E_ALL');//Same as: error_reporting(E_ALL); ini_set('display_errors','1'); ini_set('display_startup_errors','1'); require('conn.php'); ?> <form name = "search" method = "POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="keywords">Keywords:*</label> <input type="text" name="keywords" id="keywords" placeholder="Input Keywords" required> <br> <label for="search_column">Search in ... ?</label> <select name="search_column" id="search_column"> <option value="page_url">Page Url</option> <option value="link_anchor_text">Link Anchor Text</option> <option value="page_description">Page Description</option> <option value="keyphrase">Keyphrase</option> <option value="keywords">Keywords</option> </select> <br> <label for="tos_agreement">Agree to TOS or not ? *</label> <select name="tos_agreement" id="tos_agreement" required> <option value="Yes">Yes</option> <option value="No">No</option> </select> <br> <input type="button" name="search_links" id="search_links" value="Search Links!"> <br> <input type="reset"> <br> </form> <?php if($_SERVER['REQUEST_METHOD'] === 'POST') { if(ISSET($_POST['search_links'])) { if(ISSET($_POST['page_url'])) { $_SESSION['search_column'] = $_POST['page_url']; } elseif(ISSET($_POST['link_anchor_text'])) { $_SESSION['search_column'] = $_POST['link_anchor_text']; } elseif(ISSET($_POST['page_description'])) { $_SESSION['search_column'] = $_POST['page_description']; } elseif(ISSET($_POST['keyphrase'])) { $_SESSION['search_column'] = $_POST['keyphrase']; } elseif(ISSET($_POST['keywords'])) { $_SESSION['search_column'] = $_POST['keywords']; } //Re-write the following 4 lines ... mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $conn->set_charset('utf8mb4'); //Always set Charset. $query = "SELECT page_url,link_anchor_text,page_description,keyphrases,keywords FROM links WHERE $_SESSION['search_column'] = ?"; $stmt = mysqli_stmt_init($conn); if(mysqli_stmt_prepare($stmt,$query)) { mysqli_stmt_bind_param($stmt,'s',$_SESSION['search_column']); $result = mysqli_stmt_bind_result($stmt,$page_url,$link_anchor_text,$page_description,$keyphrase,$keywords); mysqli_stmt_execute($stmt); mysqli_stmt_fetch($stmt); while(mysqli_stmt_fetch($stmt)) { echo "url"; echo "<br>"; echo "anchor_text"; echo "<br>"; echo "description"; echo "<br>"; echo "keyphrases"; echo "<br>"; echo "keywords"; echo "<br>"; echo "|"; echo "<br>"; } mysqli_stmt_close($stmt); mysqli_close($conn); } else { echo "1. QUERY failed!"; } if(mysqli_stmt_prepare($stmt,$query)) { mysqli_stmt_bind_param($stmt,'sssss',$_POST['page_url'],$_POST['link_anchor_text'],$_POST['page_description'],$_POST['keyphrases'],$_POST['keywords']); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); while($row = mysqli_fetch_array($result,mysqli_assoc)) { $page_url = $row['page_url']; echo $page_url; echo "<br>"; $link_anchor_text = $row['link_anchor_text']; echo $link_anchor_text; echo "<br>"; $page_description = $row['page_description']; echo $page_description; echo "<br>"; $keyphrases = $row['keyphrases']; echo $keyphrases; echo "<br>"; $keywords = $row['keywords']; echo $keywords; echo "<br>"; echo "|"; echo "<br>"; } mysqli_stmt_close($stmt); mysqli_close($conn); } else { die("2. QUERY failed!"); } } } ?>Edited July 16, 2020 by 2020 I asked this once b4 and the answer seemed to work but now the discount is being caclulated again...I wanted the discount to stop after April 15...The below code doesn't work, can someone help??? Code: [Select] } if(date("j") < 14) { $before = $cost*.05; $before = round($before,2); $cost = $cost-$before; } Thank you in advance for ANY help that can be provided. Jennifer Hello,
I'm the sole developer of Aptugo (http://www.aptugo.com), a web RAD development environment with focus on making every developer's life easier. I've spent countless hours over the last two years developing it, and while the main focus is to be a CRUD boilerplate, it can actually build complete websites with great features (Aptugo's website was completely built with Aptugo, and google page insights gave me a score of 92 right out of the oven and without any effort).
Anyway, it would be really nice if you could spend a few minutes taking a look at Aptugo, It is free, and I really want to keep it free forever, in order to be able to achieve that, I really mouth-to-mouth promotion, so I'm not trying to sell you anything here, I'm just asking for help and your empathy! . If you could tell me: "I would use aptugo if it..." I would really appreciate it.
Have a great day,
Gaston
Dear All Good Day, i am new to PHP (a beautiful server side scripting language). i want to send a mail with line by line message i tried with different types like by placing the things in table and using <br /> but the thing is the tags are also visible in the message of the mail. Here is my code: $message1 = "Name :". $_REQUEST['name']."<br />"; $message1 .= "Surname :". $_REQUEST['surname']."<br />"; $message1 .= "Cellphone :". $_REQUEST['mobileno']."<br />"; $message1 .= "Telephone :". $_REQUEST['landno']."<br />"; $message1 .= "Fax :". $_REQUEST['fax']."<br />"; $message1 .= "Company :". $_REQUEST['company']."<br />"; $message1 .= "Email :". $_REQUEST['email']."<br />"; $message1 .= "Country :". $_REQUEST['country']."<br />"; $message1 .= "Enquity :". $_REQUEST['enquiry']."<br />"; $message1 .= "Date&Time :". $date."<br />"; For this code if try to print/echo it it is working fine it is displaying line by line, but using this variable ($message1) in the mail these <br /> are also visible. Can any one guide me to resolve(to remove these tags from the message part) this issue. Thanks in Advance. :confused: I have a dropdown list where the values are retrieved form the mysql the dropdownlist is coded in php as below: $data = mysql_query("Select * From Project"); echo "<select name = 'Project' onchange = 'showUser(this.value)'>n"; while ($row = mysql_fetch_assoc($data)) { $id = $row['Project_Id']; $ProjectName = $row['ProjectName']; echo "<option value = $id>$ProjectName"; } echo"</select>"; echo "<br/>"; echo "<br/><div id='txtHint' style='width:30em; margin:0 auto;'></div><br/>"; this dropdownlist will retrieved the names of PROJECTS available in the database. when the user click any of the rpojects, it will displayed the engagements that belong to the selected PROJECT. This is also retrieved and display in a dynamic table using ajax. i have created a javascript function as below: <script type="text/javascript"> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","try.php?q="+str,true); xmlhttp.send(); } </script> function showUser is placed in the "<select name = 'Project' onchange = 'showUser(this.value)'> my question is, is it possible that i display the data retrieved in the tables as hyperlinks? I want the user to be able to view the informations of the displayed engagements in another php page. the user can view the informations when they clicked on the hyperlinks of the engagement name that is displayed. the sample of table can be seen in the attachment. any idea on how to do this. Let me know cause im stuck HI, I'm writing a auction website .in auction website we need to check for new information every second so it needs to be ajax. we have a timer which calculate the end time of every auction and it needs to be updated every second.Do you have any idea for reducing the process of calculating maybe a client side but something that is updated by server? I mean , the timer works with client side and when the users BID , the timer needs to be refresh.So every time that Bid button hilted the time should be refresh. What's you idea?How can do something like that? Thanks So if I wanted to make sure my users were logged in, and had cookies & JavaScript enabled would this work...? Users enter site at index.php which sets a test cookie and calls itself (header location self in other words) if the test passed the user is redirected to the main page, if not then redirected to a page that has a we need cookies enabled page. Once in the main pages the cookie is checked and if present all good if not send back to index. Then I use session variables to track user data. I see this in my head but I'm not sure it works like I think and I am not sure how to code it. Your feedback would be greatly appreciated, and any pointers in how to code it would be prized as it would help me learn more so I don't have to ask next time. i dont know how to fix this problem..please help me guys --- so this is my index Code: [Select] <? session_start(); if(!isset($_SESSION['administrator'])){ header("location:../login.php"); } include ("../config.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>e-Leave</title> <link rel="stylesheet" href="../style.css" type="text/css" media="all" /> </head> <body> <!-- Header --> <div id="header"> <div class="shell"> <!-- Logo + Top Nav --> <div id="top"> <h1>e-Leave (Cpanel)</h1> <div id="top-navigation"> Welcome <a href="#"><strong><? $user=($_SESSION['administrator']); echo $user; ?></strong></a> <span>|</span> <a href="index.php">Home</a> <span>|</span> <a href="logout.php">Log out</a> </div> </div> <!-- End Logo + Top Nav --> <!-- Main Nav --> <? include ("../header/header_cpanel.php"); ?> <!-- End Main Nav --> </div> </div> <!-- End Header --> <!-- Container --> <div id="container"> <div class="shell"> <!-- Main --> <div id="main"> <div class="cl"> </div> <!-- Content --> <div id="content"> <? if(isset($_GET[view])) { $view = $_GET[view]; } if ($view == '' ){ include ('employeeleaveapplication.php'); } if ($view == 'createaccount' ){ include ('createaccount.php'); } if ($view == 'createaccounta' ){ include ('createaccount_add.php'); } if ($view == 'createaccounti' ){ include ('createaccount_insert.php'); } if ($view == 'createaccountd' ){ include ('createaccount_delete.php'); } if ($view == 'createaccounte' ){ include ('createaccount_edit.php'); } if ($view == 'createaccountu' ){ include ('createaccount_update.php'); } if ($view == 'createlogina' ){ include ('createlogin_add.php'); } if ($view == 'createlogini' ){ include ('createlogin_insert.php'); } if ($view == 'employeedirectory' ){ include ('employeedirectory.php'); } if ($view == 'employeedirectoryl' ){ include ('employeedirectory_list.php'); } if ($view == 'employeedirectorya' ){ include ('employeedirectory_adjustment.php'); } if ($view == 'employeedirectoryai' ){ include ('employeedirectory_adjustment_insert.php'); } if ($view == 'employeedirectoryca' ){ include ('employeedirectory_cancel_adjustment.php'); } if ($view == 'employeedirectorycl' ){ include ('employeedirectory_cancel_application.php'); } if ($view == 'changepassword' ){ include ('changepassword.php'); } if ($view == 'changepasswordi' ){ include ('changepassword_insert.php'); } if ($view == 'branch' ){ include ('setup_branch.php'); } if ($view == 'brancha' ){ include ('setup_branch_add.php'); } if ($view == 'branchi' ){ include ('setup_branch_insert.php'); } if ($view == 'branchd' ){ include ('setup_branch_delete.php'); } if ($view == 'branche' ){ include ('setup_branch_edit.php'); } if ($view == 'branchu' ){ include ('setup_branch_update.php'); } if ($view == 'designation' ){ include ('setup_designation.php'); } if ($view == 'designationa' ){ include ('setup_designation_add.php'); } if ($view == 'designationi' ){ include ('setup_designation_insert.php'); } if ($view == 'designationd' ){ include ('setup_designation_delete.php'); } if ($view == 'designatione' ){ include ('setup_designation_edit.php'); } if ($view == 'designationu' ){ include ('setup_designation_update.php'); } if ($view == 'leavetype' ){ include ('setup_leavetype.php'); } if ($view == 'leavetypea' ){ include ('setup_leavetype_add.php'); } if ($view == 'leavetypei' ){ include ('setup_leavetype_insert.php'); } if ($view == 'leavetyped' ){ include ('setup_leavetype_delete.php'); } if ($view == 'leavetypee' ){ include ('setup_leavetype_edit.php'); } if ($view == 'leavetypeu' ){ include ('setup_leavetype_update.php'); } if ($view == 'publicholiday' ){ include ('setup_publicholiday.php'); } if ($view == 'publicholidayd' ){ include ('setup_publicholiday_delete.php'); } if ($view == 'publicholidaya' ){ include ('setup_publicholiday_add.php'); } if ($view == 'publicholidayi' ){ include ('setup_publicholiday_insert.php'); } if ($view == 'publicholidaye' ){ include ('setup_publicholiday_edit.php'); } if ($view == 'publicholidayu' ){ include ('setup_publicholiday_update.php'); } if ($view == 'report' ){ include ('report.php'); } if ($view == 'report_leave' ){ include ('report_leave.php'); } if ($view == 'print' ){ include ('report_print.php'); } ?> </div> <!-- End Content --> <!-- Sidebar --> <? include ("../header/dashboard_cpanel.php"); ?> <!-- End Sidebar --> <div class="cl"> </div> </div> <!-- Main --> </div> </div> <!-- End Container --> <div id="footer"> <? include ("../footer/footer.php"); ?> </div> </body> </html> -- this is my dashboard panel code Code: [Select] <div id="sidebar"> <!-- Box --> <div class="box"> <!-- Box Head --> <div class="box-head"> <h2><b>Dashboard</b></h2> </div> <!-- End Box Head--> <div class="box-content"> <a href="index.php?view=createaccount"><span> <img src="../images/createaccount.jpg"/> Create Account</span></a> <div class="cl"> </div> <div class="cl"> </div> <a href="index.php?view=employeedirectory"><br><span> <img src="../images/employee.jpg"/> Employee Directory</span></a> <div class="cl"> </div> <a href="index.php?view=report"><br><span> <img src="../images/status-report1.jpg"/> Report</span></a> <div class="cl"> </div> <div class="cl"> </div><a href="index.php?view=changepassword"><br> <span> <img src="../images/key.jpg"/> Change Password</span></a> </div> </div> <div class="box"> <!-- Box Head --> <div class="box-head"> <h2><b>Setup</b></h2> </div> <!-- End Box Head--> <div class="box-content"> <a href="index.php?view=branch"><br><span> <img src="../images/branch.jpg"/> Branch</span></a> <div class="cl"> </div> <div class="cl"> </div><a href="index.php?view=designation"><br> <span> <img src="../images/designation.jpg"/> Designation</span></a> <div class="cl"> </div> <div class="cl"> </div><br> <a href="index.php?view=leavetype"><span> <img src="../images/leave.jpg"/> Leave Type</span></a> <div class="cl"> </div> <div class="cl"> </div><br> <a href="index.php?view=publicholiday"><span> <img src="../images/pb.jpg"/> Public Holiday</span></a> </div> </div> </div> ----- and this is the where the problem page is Code: [Select] <!-- Box --> <div class="box"> <!-- Box Head --> <div class="box-head"> <h2 class="left">Report</h2> </div> <!-- End Box Head --> <!-- Table --> <div class="table"> <div class="right"> <br> </div> <div id="box" valign="top"> <br> <h3><FORM name ="reportbutton" method="post" align="left" action="index.php?view=report"> <strong>Leave Application Listing </strong>| <Input type = "Submit" Name = "Submit1" Class="button" VALUE = "Back To Report"> </h3> </FORM> <br><br> <form name="leavebutton" method="post" action="index.php?view=report_leave"> <? $b=$_GET['b']; $m=$_GET['m']; $y=$_GET['y']; if ($b <> '' && $m <> '' && $y <> '') { $branch=$b; $leavemonth=$m; $leaveyear=$y; } else { $branch=$_POST['branch']; $leavemonth=$_POST['leavemonth']; $leaveyear=$_POST['leaveyear']; } $connection=mysql_connect("$server", "$username", "$password") or die("Could not establish connection"); mysql_select_db($database_name, $connection) or die ("Could not select database"); $query="SELECT * from tblworkgroup"; $result=mysql_query($query);?> Branch <select name="branch" > <option value="all">ALL Branches</option> <? while($row=mysql_fetch_array($result)) { ?> <option value= "<?=$row['WorkGroupID']?>" <? if ($branch==$row['WorkGroupID']){ echo 'selected'; } ?> ><?=$row['WorkGroupName']?></option> <? } ?> </select> </td> </tr> <br><br><br> Month <select name="leavemonth" > <option value = "1" <? if ($leavemonth==1){ echo 'selected'; } ?>>January</option> <option value = "2" <? if ($leavemonth==2){ echo 'selected'; } ?>>February</option> <option value = "3" <? if ($leavemonth==3){ echo 'selected'; } ?>>March</option> <option value = "4" <? if ($leavemonth==4){ echo 'selected'; } ?>>April</option> <option value = "5" <? if ($leavemonth==5){ echo 'selected'; } ?>>May</option> <option value = "6" <? if ($leavemonth==6){ echo 'selected'; } ?>>June</option> <option value = "7" <? if ($leavemonth==7){ echo 'selected'; } ?>>July</option> <option value = "8" <? if ($leavemonth==8){ echo 'selected'; } ?>>August</option> <option value = "9" <? if ($leavemonth==9){ echo 'selected'; } ?>>September</option> <option value = "10" <? if ($leavemonth==10){ echo 'selected'; } ?>>October</option> <option value = "11" <? if ($leavemonth==11){ echo 'selected'; } ?>>November</option> <option value = "12" <? if ($leavemonth==12){ echo 'selected'; } ?>>December</option> </select> Year <select name="leaveyear" > <option value = "2010" <? if ($leaveyear==2010) { echo 'selected';} ?>>2010</option> <option value = "2011" <? if ($leaveyear==2011) { echo 'selected';} ?>>2011</option> <option value = "2012" <? if ($leaveyear==2012) { echo 'selected';} ?>>2012</option> <option value = "2013" <? if ($leaveyear==2013) { echo 'selected';} ?>>2013</option> <option value = "2014" <? if ($leaveyear==2014) { echo 'selected';} ?>>2014</option> <option value = "2015" <? if ($leaveyear==2015) { echo 'selected';} ?>>2015</option> <option value = "2016" <? if ($leaveyear==2016) { echo 'selected';} ?>>2016</option> <option value = "2017" <? if ($leaveyear==2017) { echo 'selected';} ?>>2017</option> </select> <input type='submit' name='submit' value='Preview' Class="button" onclick='return validate()'> </div> </form> <br /><br /> <div id="box" valign="top"> <h3> <strong>Leave Application Details</strong>  </h3> <br><br> <FORM name="printbutton" method="post" align="left" action="report_print.php" target="_blank"> <input type="hidden" name="leavemonth" value="<?php echo $leavemonth; ?>"> <input type="hidden" name="leaveyear" value="<?php echo $leaveyear; ?>"> <input type="hidden" name="branch" value="<?php echo $branch;?>"> <Input type = "Submit" Name = "Submit1" Class="button" VALUE = "Print Leave Details"> </form> <table width="80%" align="center" > <thead> <tr> <th width="700px" align="left">Name</a></th> <th width="500px" align="center"></a>Application Date</th> <th width="500px" align="center"></a> </th> <th width="500x" align="right"></a>Reason</th> </tr> </thead> <tbody> <? /*echo "branch:".$branch.'<br />'; echo "leavemonth:".$leavemonth.'<br />'; echo "leaveyear:".$leaveyear.'<br />';*/ //-------------------------------------------------- if ($leavemonth =='' || $leaveyear =='' || $branch == '') { // one value missing, so don't display } else { // start display data $branchtracker = ''; if ($branch=='all'){ $branch = '%'; } $rs = mysql_query( " call vwleavereport('$leavemonth', '$leaveyear', $branch, 0);"); $query="SELECT *, MONTH(tblleaveapplication.DateFrom) as DFMonth, MONTH(tblleaveapplication.DateTo) as DTMonth, YEAR(tblleaveapplication.DateFrom) as DFYear FROM `tblleaveapplication` LEFT JOIN `tblemployee` ON tblleaveapplication.employeeid = tblemployee.id WHERE WorkGroupID LIKE '".$branch."' AND ( (MONTH(tblleaveapplication.DateFrom)=".$leavemonth." AND YEAR(tblleaveapplication.DateFrom)=".$leaveyear.") OR (MONTH(tblleaveapplication.DateTo)=".$leavemonth." AND YEAR(tblleaveapplication.DateFrom)=".$leaveyear.") ) ORDER BY WorkGroupID "; $result = mysql_query($query); while($row=mysql_fetch_array($result)) { if ($branchtracker<>$row['WorkGroupID']){ echo '<tr><td colspan=4 style="background-color: #e8e8e8; font-weight: bold;">'.$row['WorkGroupID'].'</td></tr>'; $branchtracker = $row['WorkGroupID']; } echo '<tr>'; echo '<td>'.$row['EmployeeName'].'</td>'; echo '<td>'.$row['DateFrom'].'</td>'; echo '<td>'.$row['DateTo'].'</td>'; echo '<td>'.$row['Purpose'].'</td>'; echo '</tr>'; } } ?> </table> The problem is the panel should be out on the RIGHT side..how do i fix it. A few friends of mine run a little competition between ourselves for a bit of fun. This has been in the past, a sports prediction spreadsheet where we predict the outcomes of champions in various football leagues around the world.
Up to now its always been a very laborious spreadsheet with that my friend can no longer be bothered to do.
is there any way I can do this in php / html?
There would be 8 players predicting the outcome of 6 leagues. We award points for who gets the most, half points for coming close etc.
Any ideas as to what way to approach this would be appreciated. I amvery proficient in HTML and CSS, but a bit of a novice in PHP......but if there is a script or some idea to get this up and running I would be very appreciative.
Thanks
Hi I know my title doesn't give any information but I really have no idea what my problem is. The problem I have is that for some reason my code just stopped working, it was working fine in the beginning and then all of a sudden I'm getting undifined index: item, and I'm not sure what it was that I did wrong since it was working fine in the beginning. Can someone please help because this has me confused Thank you
Hi guys, thanks This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=313729.0 OMFG! I have no idea what is going on! Code: [Select] <?php if (isset($user_log)) { //************************************************************************************************************************************************ $user = $_SESSION['user']; $query = " SELECT title, sum, story_id FROM draft WHERE user='$user' "; $select = mysql_query($query); while($rows = mysql_fetch_assoc($select)); { $titledb = $rows['title']; $sumdb = $rows['sum']; $id_db = $rows['story_id']; echo "$titledb"; } } //************************************************************************************************************************************************* ?> I have no idea whats going on I have tried: 1. Using mysql_num_rows I get a number (1) 2.Trying to use the mysql_fetch_assoc outside of the while loop. The values are getting echo'ed out, but when I put the code in the while loop and the Code: [Select] $rows=mysql_fetch_assoc in the while peramiters, nothing happening. I have also tried putting other code in the while loop and it works. Its just the mysql values. also I tried using or die(mysql_errror()), It dies but no mysql error Hi all, i want to write seating plan page, i want it to work by having the logged in user click on a link or image and the system will mark that users username into that seat. I have everything working in terms of the log in but as far as this page goes i really have no idea how i would start with it. If your not sure what i mean i can put it this way to make it much more understandable. If my page had the numbers 1 through to 49 listed down the side and next to each number it says as default "availible", but if the user click on that number the text next to that number changes from "availible" to the users username and no one others can click on that number as its "seat" or "number" has been taken. My users are stored within a mysql database and my site uses sessions like so: $_SESSION[username] = $row[username]; Many thanks for your help I'm building a game and I'm wanting to create mobile monsters for people to click on and fight. I have an arena that works fine, but I would love to have this additional feature. Here's what it would entail: Clicking on the name of the monster. Starting the fight (which is already designed and implemented) I need help with: Is there a way to make a mobile link, essentially. The monsters themselves are identified in a mySQL database with a specific ID. In the arena, the players click on a monster, and the battle begins. So, I need a way to make this "link" mobile. Thoughts? Ideas? Suggestions? Thanks! |