marisha
-
Posts
5 -
Joined
-
Last visited
Never
Posts posted by marisha
-
-
Hello All,
I am using RGraph with Php to generate graphical report. They work together very well but now I have a logic issue. I am explaining it below
Scenario - I have a multiple select drop down from which I can select multiple Buidling Numbers and Month
<form name = "form1" method="post" > <select name="BuildingID[] name="buildingID" MULTIPLE> <option>Choose</option> <?//=$options?> </select> <select name="MonthID[]" name="Month" MULTIPLE> <option>Choose</option> <?//=$optionsMonth?> </select> </form>
Step - Based on the number of buildings selected I have to fetch data from MySql database and make a data array for each building which will later on be represented as one line for each Building selected
if($BuildingID) { $i = 1; for(;$i<=4;$i++) { foreach ($BuildingID as $t) { $buildingWithAddress = mysql_query(SELECT Metal_Quantity FROM `Physical_Plant_BuildingLevel_Data` WHERE BuildingID = $t AND Month IN ($MonthString) AND Year = $Year); [u][b]$data = array(); I NEED A NEW VARIABLE FOR EACH ITERATION. KIND OF DYNAMIC VARIABLES [/b][/u] $num_rows = mysql_num_rows($buildingWithAddress); while($nt=mysql_fetch_array($buildingWithAddress)) { $data[] = $nt["RR"]; } [u][b] $data_string = "[" . join(", ", $data) . "]"; I NEED A NEW STRING VARIABLE FOR EACH ITERATION. KIND OF DYNAMIC VARIABLES [/b][/u] } } }
My Problem boils down to how can I make a array variable for each iteration of loop
-
The Background
---------------------
1) The vendor will submit his excel sheet on website and the whole data will get imported in the MySql
2) The amount of data that we are going to receive in excel sheet will be like 9 - 10 columns , with macros and inbuilt functions and atleast 60 rows.
3) We are going to receive 10 - 15 excel sheet per month. We rely on these data for reporting.
My thought process
--------------------------
My database is MySql , I am using Php for server side form handling. I have never designed a system in Php to handle MsExcel. I have experience in designing such website in .Net both being Microsoft product have alot of compatiility.
Can the gurus suggest me any online tutorial I can refer or the way I should approcah it.
Thanks
Marisha
-
Thank you for replying ....
I have a hidden field in "form1"
<input type="hidden" name="form1submit" value="1"/>
THIS IS WHEN UPPER FORM or form1 is submitted
if (array_key_exists('form1submit', $_POST))
{
//HERE I AM GENERATING A DYNAMIC FORM BASED ON THE NUMBER OF ROWS COUNT
<form name = "form2" method = "post">
echo <table>
echo <tr>
echo<td>VENDOR</td>
echo<td>DATE</td>
echo<td>NET RECYCLED WEIGHT</td>
echo </tr>
for(IT ITERATES TILL I GENERATE THE NUMBER OF ROWS THAT HAS TO BE ENTERED)
{
I AM GENERATING ROWS HERE
}
echo <input type = "submit" name = "submit2" value = "submit2">
echo</table>
//MY HIDDEN FIELD
<input type="hidden" name="form2submit" value="1"/>
</form>
}
//PROCESSING OF INNER FORM
if (array_key_exists('form2submit', $_POST))
{
}
?>
So if I do the following I will be able to access the POST of inner form "form2"
Please let me know if this is what you ment......
-
Hello All,
I am building a web based data entry project for my University Recycling Department
1) In the first level the user will enter the number of "rows" that he has to enter it can be any number form 4- 10 . Each row will contain "Vendor Name","Date","Net Recycled Weight"
2) Depending on the number of rows entered by the user I am generating a table structure that has
2.1) A <select> containing vendor names(I am querying for this and then storing the result in an Associative Array and then parsing it for select in every way)
2.2) A text box for the date
2.3) A text box for the Net Recycled Weight
------------------------------------------------
Here is the logic I have implemented so far
<html>
<head></head>
<body>
<form name = "form1" method = "post">
<select>HERE THE USER CAN SELECT THE NUMBER OF ROWS HE WANTS TO ENTER</select>
<input type = "submit" value = "submit1" name = "submit1">
</form>
<body>
</html>
<?php
if(submit1 has been clicked )
{
//HERE I AM GENERATING A DYNAMIC FORM BASED ON THE NUMBER OF ROWS COUNT
<form name = "form2" method = "post">
echo <table>
echo <tr>
echo<td>VENDOR</td>
echo<td>DATE</td>
echo<td>NET RECYCLED WEIGHT</td>
echo </tr>
for(IT ITERATES TILL I GENERATE THE NUMBER OF ROWS THAT HAS TO BE ENTERED)
{
I AM GENERATING ROWS HERE
}
echo <input type = "submit" name = "submit2" value = "submit2">
echo</table>
</form>
HOW CAN I ACCESS THE POST METHOD OF FORM 2
}
?>
MY PROBLEM
---------------
I WANT TO KNOW THE FOLLOWING
1) It this the correct way to do it
2) how can I access the data entered in each dynamic row as I have to validate it and then enter the data in MySql
3) I am not sure how I will access the submit button event of the dynamically generated form
I hope I can get some help
Thanks,
Marisha
RGraph and Php (How to generate dynamic data array based on MultiSelect Dropdon)
in PHP Coding Help
Posted
I have made progress bu using the logic of a two-dimensional array. I have not reached my goal yet I will keep updating as I make progress.
$arrayData = array();
$i = 1;