Jump to content

lanredoyes

Members
  • Posts

    15
  • Joined

  • Last visited

lanredoyes's Achievements

Member

Member (2/5)

0

Reputation

1

Community Answers

  1. Thanks guys for your responses. I have figured it out and it's working perfectly now.
  2. Thanks @mac_gyver, it worked like a charm when I ran it as described above. However, when I tried to implement it in my project, it just did nothing. I am using Framework7 with it's Template7 engine and I have declared the execution in the pageInit of myApp.js file. I don't know what to do anymore as it seem like for any script to run, it must be already declared in the framework which I don't know where to do just that. Any framework7 help pls.
  3. When I submit the form as it is above, the data goes into the database and it appears in the table below as well without error but this is done with page reload. I want the form to process without page reload and for the table below to display databse content. I am sorry if I am not been clear enough, the onSubmit event doesn't just work. No error display of any kind. Thanks
  4. Thanks for the response. The help I need now is to make the form process without page reload. I know this is possible with Ajax but I just can't seem to make it work. Another thing is with each form process, the table below has to be updated with the new content of the database also without reloading the page. I will be cleaning up the code once I get the script to work as expected. Thanks
  5. Hello, I have a page that does two things at the same time. One is to ask the use to input a field in an input field and submit and the other is to display everything the user as saved in the database. Presently, the script is working as expected but i am trying to implement this using jQuery Ajax so as to remove page reload. I have gone through lots of tutorials on the internet and have done everything they instructed. I am at a deadline here and please asking for a way out. The screen shot of my output is attached and my current code is presented below. <?php //Include Functions include('includes/Functions.php'); //Include Notifications include ('includes/notification.php'); // add new category if (isset($_POST['submit'])) { $category = $mysqli->real_escape_string($_POST["account"]); //add new category $sql="INSERT INTO account (UserId, AccountName) VALUES (?,?)"; if($statement = $mysqli->prepare($sql)){ //bind parameters for markers, where (s = string, i = integer, d = double, b = blob) $statement->bind_param('is',$UserId, $category); $statement->execute(); } $msgBox = alertBox($SaveMsgAccount); } //Get list category $GetList = "SELECT AccountId, AccountName FROM account WHERE UserId = $UserId ORDER BY AccountName ASC"; $GetListCategory = mysqli_query($mysqli,$GetList); //Include Global page include ('includes/global.php'); ?> <div class="pages"> <div data-page="projects" class="page no-toolbar no-navbar"> <div class="page-content"> <div class="navbarpages"> <div class="nav_left_logo"><a <?php ActiveClass("index");?> href="index.php"><img src="images/logo.png" alt="" title="" /></a></div> <div class="nav_right_button"><a <?php ActiveClass("index.php?page=menu");?> href="index.php?page=menu"><img src="images/icons/white/menu.png" alt="" title="" /></a></div> </div> <div id="pages_maincontent"> <h2 class="page_title">My Accounts</h2> <div class="page_content"> <div id="container"> <ul class="responsive_table"> <li class="table_row"> <div class="table_section2">Add New Account</div> </li> <li class="table_row"> <div class="contactform"> <form class="cmxform" method="post" id="AccountForm" action="" > <label><?php echo $Category; ?></label> <input required placeholder="<?php echo $Account; ?>" name="account" type="text" autofocus class="form_input" /> <input type='hidden' name='action' value='create' /> <input type="submit" name="submit" class="form_submit" id="submit" value="<?php echo $SaveAccount; ?>" /> </form> </div> <script> $(function(){ $('#submit').click(function(){ $('#container').append('<img src = "images/loader.gif" alt="Loading..." id = "LoadingGraphic" />'); $.ajax({ url: 'accounts.php', type: 'POST', data: $('#AccountForm').serialize(), success: function(result){ $('#response').remove(); $('#container').append('<p id = "response">' + result + '</p>'); $('#LoadingGraphic').fadeOut(500); } }); e.preventDefault(); //STOP default action }); }) </script> </li> </ul> </div> <br /><br /> <h3>My Account List</h3> <ul class="responsive_table"> <li class="table_row"> <div class="table_section"><?php echo $Account; ?></div> <div class="table_section"> </div> </li> <?php while($col = mysqli_fetch_assoc($GetListCategory)){ ?> <li class="table_row"> <div class="table_section"><?php echo $col['AccountName'];?></div> <div class="table_section_last"> </div> </li> <?php } ?> </ul> </div> </div> </div> </div> </div> Thanking you for any help rendered.
  6. Hello, I am working on a personal project which is to generate a set of unique codes and store them in a database. The concept of the project is for me to be able to determine the numbers of codes I want to generate and insert each of them into the database. I have been able to come up with something with the help of a tutorial which is working but not inputting into database and it allows one generation at a time. Please see my code below $username = "root"; $password = "password"; $hostname = "localhost"; $database = "gencode"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db($database,$dbhandle) or die("Could not select $database"); $unique_ref_length = 11; $unique_ref_found = false; $possible_chars = "23456789ABCDFGHJKLMNPQRSTWXYZ"; while (!$unique_ref_found) { $unique_ref = ""; $i = 0; while ($i < $unique_ref_length) { $char = substr($possible_chars, mt_rand(0, strlen($possible_chars)-1), 1); $unique_ref .= $char; $i++; } $query = "SELECT `order_ref_no` FROM `orders` WHERE `order_ref_no`='".$unique_ref."'"; $result = mysql_query($query) or die(mysql_error().' '.$query); if (mysql_num_rows($result)==0) { $unique_ref_found = true; } } echo 'Our unique reference number is: '.$unique_ref; Your assistance will be greatly appreciated.
  7. Thank you very much sir, am sorry i have not been able to come online for awhile it was due to bad internet. Really appreciate your efforts. Many Thanks.
  8. About the project, I have been able to create a way to populate database data on the browser as in form a report whereby users can then query it and get the limited data they want on the browser through the help of some tutorials gotten. With the graph, i then intend that the user enters the data from the query into the form themselves. However, I am having issues to get the script pull from the form. @Cups, I used the get method as suggested and without the graph script, the form is working with the exception of the textarea field. Please i need help as to how to get this final stage to work as this is almost the final stage of my project. Many Thanks. My code is below: <?php if(isset($_GET['submit'])) { $title = (int)$_GET['title']; $legend = (int)$_GET['legend']; } // content="text/plain; charset=utf-8" // Example for use of JpGraph, // ljp, 01/03/01 20:32 require_once ('../jpgraph.php'); require_once ('../jpgraph_bar.php'); // We need some data $datay=array(-0.36,0.25,-0.21,0.43,0.31,0.04,-0.23,0.031,0.29,-0.08,0.07,0.19); // Setup the graph. $graph = new Graph(1000,400); $graph->img->SetMargin(60,150,30,50); $graph->SetScale("textlin"); $graph->SetMarginColor("silver"); $graph->SetShadow(); // Set up the title for the graph $graph->title->Set("$title"); $graph->title->SetFont(FF_VERDANA,FS_NORMAL,16); $graph->title->SetColor("darkred"); // Setup font for axis $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10); $graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10); // Show 0 label on Y-axis (default is not to show) $graph->yscale->ticks->SupressZeroLabel(false); // Setup X-axis labels $graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); $graph->xaxis->SetLabelAngle(50); // Set X-axis at the minimum value of Y-axis (default will be at 0) $graph->xaxis->SetPos("min"); // "min" will position the x-axis at the minimum value of the Y-axis // Create the bar pot $bplot = new BarPlot($datay); $bplot->SetWidth(0.6); $bplot->SetLegend("$legend","blue"); // Setup color for gradient fill style $bplot->SetFillGradient("navy","steelblue",GRAD_MIDVER); // Set color for the frame of each bar $bplot->SetColor("navy"); $graph->Add($bplot); // Finally send the graph to the browser $graph->Stroke(); ?> <!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>Untitled Document</title> </head> <body> <p> <form id="form1" name="form1" method="get" action="<?= $PHP_SELF ?>"> <label for="title">Graph Title:</label><br/> <input type="text" name="title" id="title" /><br/><br/> <label for="legend">Graph Legend:</label><br/> <input type="text" name="legend" id="legend" /><br/><br/> <label for="values">Enter X values(seperate with comma):</label><br/> <textarea name="values" id="values" cols="45" rows="5"></textarea><br/><br/> <input type="submit" name="generate" id="generate" value="Generate Graph" /> </form> </p> </body> </html>
  9. Thanks, seriously i really appreciate your responses. The idea is to have a graph of month versus records for a particular year using a particular marking_scheme. I am really lost as to how to get everything right. Please your assistance and clearance will be appreciated as this represents 30% of my school grade work.
  10. Hello, thanks for response really appreciate it. Firstly I must say i am a newbie to php and all i know presently is through associated documentation of the script/software. I have please attached the code to my html form below. <form id="form" action="#" method="post" name="form"> <table width="50%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="6" align="center"><strong>Draw Graph</strong></td> </tr> <tr> <td colspan="6" align="left"><strong>X-Axis:</strong></td> </tr> <tr> <td width="90" align="left"><label for="state"><strong>State:</strong></label></td> <td width="166" align="left"><select name="state" id="state" value=""> <option value="Select All">Select All</option> <option value="FCT">FCT</option> <option value="Abia">Abia</option> <option value="Adamawa">Adamawa</option> <option value="Akwa-Ibom">Akwa-Ibom</option> <option value="Anambra">Anambra</option> <option value="Bauchi">Bauchi</option> </select></td> <td width="94" align="left"><label for="year_of_record"><strong>Year:</strong></label></td> <td width="134" align="left"><select name="year_of_record" id="year_of_record" value=""> <option value="Select All">Select All</option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> </select></td> <td width="95" align="left"><label for="month_of_record"><strong>Month:</strong></label></td> <td width="210" align="left"><select name="month_of_record" id="month_of_record" value=""> <option value="Select All">Select All</option> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select></td> </tr> <tr> <td colspan="3" align="right"></td> <td colspan="3"></td> </tr> <tr> <td colspan="3" align="right"></td> <td colspan="3"></td> </tr> <tr> <td align="left"><label for="value_of_reading"><strong>Value of Reading:</strong></label> </td> <td align="left"><input name="value_of_reading" maxlength="100" type="text" size="50" value="All Values"></td> <td colspan="5" align="left"> </td> </tr> <tr> <td colspan="3" align="right"></td> <td colspan="3"></td> </tr> <tr> <td colspan="3" align="right"></td> <td colspan="3"></td> </tr> <tr> <td colspan="6" align="left"> </td> </tr> <tr> <td colspan="6" align="left"><strong>Y-Axis:</strong></td> </tr> <tr> <td width="90" align="left"><label for="state"><strong>State:</strong></label></td> <td width="166" align="left"><select name="state" id="state" value=""> <option value="Select All">Select All</option> <option value="FCT">FCT</option> <option value="Abia">Abia</option> <option value="Adamawa">Adamawa</option> <option value="Akwa-Ibom">Akwa-Ibom</option> <option value="Anambra">Anambra</option> <option value="Bauchi">Bauchi</option> </select></td> <td width="94" align="left"><label for="year_of_record"><strong>Year:</strong></label></td> <td width="134" align="left"><select name="year_of_record" id="year_of_record" value=""> <option value="Select All">Select All</option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> </select></td> <td width="95" align="left"><label for="month_of_record"><strong>Month:</strong></label></td> <td width="210" align="left"><select name="month_of_record" id="month_of_record" value=""> <option value="** Select **">** Select **</option> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select></td> </tr> <tr> <td colspan="3" align="right"></td> <td colspan="3"></td> </tr> <tr> <td colspan="3" align="right"></td> <td colspan="3"></td> </tr> <tr> <td align="left"><label for="value_of_reading"><strong>Value of Reading:</strong></label> </td> <td align="left"><input name="value_of_reading" maxlength="100" type="text" size="50" value="All Values"></td> <td colspan="5" align="left"> </td> </tr> <tr> <td colspan="6" align="center"><input type="submit" value="Draw Graph"></td> </tr> </table> </form> Here is the current schematic of the database. ----------------------------------------------------------------------------------- | First_Name | Last_Name | Class | State | Year | Month | Record | Marking_Scheme | ----------------------------------------------------------------------------------- | | | | Osun | 2010 | March | 23 | Drudgery | ----------------------------------------------------------------------------------- | | | | Edo | 2012 | April | 56 | Drudgery | ----------------------------------------------------------------------------------- | | | | Osun | 2010 | June | 110 | Maxfield | ----------------------------------------------------------------------------------- | | | | Niger | 2009 | July | 87 | Drudgery | ----------------------------------------------------------------------------------- As from the schematic, there is only one database storing values for 1. Different State 2. Different year for each state 3. The twelve months for each year 4. Individual Records for each month 5. Each record gotten with peculiar scheme What i am hoping to achieve is a situation whereby the user can use the html form to generate a graph for a particular state and year using a particular marking_scheme whereby the graph of the months of the year against the records will be provided. I know I have not been this explanatory from the beginning but I have been stressed of late as project submission deadline is fast approaching. Many thanks in anticipation of your assistance.
  11. Hello, what i am actually trying to say is that the submitted data from the form will in turn query the database and plot a graph with the queried result from the database
  12. Thanks very much for the quick response but i really dont quit understand. So please let me get you right. The form action will be self and in the action, each field will be called by $state //etc and in the section where the graph will appear, the img tag should be there. If i may ask, can you pls help me with the structure of the form action as i am kinda clueless. Many thanks and i greatly appreciate
  13. Hello, Please i need help using jpgraph or rpgraph. I am working on a php/mysql project that as to do with graphing. The issue is not to be able get both graphing solution to work or pull data from the database as i have been able to do that from their provided documentation, the issue is allowing the user to be able to query the database through a form on the page. I have a large database with fields like 'state', 'year', 'month', 'readings', and i want the user to be able to query the db themselves so as to get the very graph they want. the form the user will see will have the four fields both on the x and y axis so that when the user select a particular year against the readings only the values of each month of that year will be displayed. The look of the form has been attached. Really appreciate a response as i am very desperate about this now. Many thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.