473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to store the data into an array in numeric form?

i have got information posted from html form into a php file. i have accessed it through $_POST array. now i want to store these values in an array in numeric form but they always turn out to be string. i have to generate pie charts using it but it is not working as the rest of the code will only accept integer data. what should i do?

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once ('C:\wamp\www\new project\jp_graph\src\jpgraph.php');
  3. require_once ('C:\wamp\www\new project\jp_graph\src\jpgraph_pie.php');
  4. require_once ('C:\wamp\www\new project\jp_graph\src\jpgraph_pie3d.php');
  5.  
  6. $d1=$_POST['s1'];
  7. $d2=$_POST['s2'];
  8. $d3=$_POST['s3'];
  9. $d4=$_POST['s4'];
  10. $d5=$_POST['s5'];
  11.  
  12. $data= array($d1,$d2,$d3,$d4,$d5);
  13.  
  14. //there is no error in this part of the code
  15. //it works fine if i pass integer values in array.
  16. $graph = new PieGraph(400,200,'auto');
  17. $graph->SetShadow();
  18.  
  19. // Set A title for the plot
  20. $graph->title->Set("3D Pie Client side image map");
  21. $graph->title->SetFont(FF_FONT1,FS_BOLD);
  22.  
  23. // Create
  24. $p1 = new PiePlot3D($data);
  25. $p1->SetLegends(array("Jan (%d)","Feb","Mar","Apr","May","Jun","Jul"));
  26. $targ=array("pie3d_csimex1.php?v=1","pie3d_csimex1.php?v=2","pie3d_csimex1.php?v=3",
  27.             "pie3d_csimex1.php?v=4","pie3d_csimex1.php?v=5","pie3d_csimex1.php?v=6");
  28. $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
  29. $p1->SetCSIMTargets($targ,$alts);
  30.  
  31. // Use absolute labels
  32. $p1->SetLabelType(1);
  33. $p1->value->SetFormat("%d kr");
  34.  
  35. // Move the pie slightly to the left
  36. $p1->SetCenter(0.4,0.5);
  37.  
  38. $graph->Add($p1);
  39.  
  40.  
  41. // Send back the HTML page which will call this script again
  42. // to retrieve the image.
  43. $graph->StrokeCSIM();
  44.  
  45.  
  46.  
  47. ?>
  48.  
  49.  
Nov 21 '10 #1
1 2141
Dormilich
8,658 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. $x = (int) $_POST['key'];
Nov 21 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JC | last post by:
How do I extract data from a form into the main form for processing? For instance, I have several image files in a form called images(images.frm), indexed from 0 to 99, and I want to import these...
1
by: Hale | last post by:
Hi, I'm having a problem storing an array inside of a hash. I'm bringing in a hash via a reference and I want to assign a value to it. This is what I'm doing: push (@{$$node->{ELEMENTS}},...
3
by: Logan | last post by:
I am running IIS5, Win2k Server, and .Net Framework 1.1. For some reason asp forms will not post data. So I have a form with a text box. The form's method is set to post and I have a submit...
0
by: Jill | last post by:
I have a form with a text boxes on it. As part of validating the data entered on the form, a message box can return the user to the form to fix data. Sometimes, but not all of the time, after the...
3
by: Brad | last post by:
I am storing an array which contains about a dozen chracter items to a Session variable. Later, I need to use this array so I am doing the following: Dim eventTypes As String() =...
0
by: rajmgopal | last post by:
Hello Everyone I am getting the following error when i try to insert a record into Sql Server 2005 from my VB 2005 application. sqlEx = {"Error converting data type numeric to numeric."} I...
5
by: hfk0 | last post by:
Hi, I'm new to ASP.net, SQL Server and visual studio.net, and I'm having problem inserting and storing data from a web form to a SQL database. I created a simple ASP.NET web form, a simple SQL...
2
by: Griff | last post by:
Hi I have an HTML search page that contains a drop-down box with approximately 78,000 items in it. The actual content of this select box varies depending upon some of the parameters a user...
13
by: kcddoorman | last post by:
In my form I have a text box. This textbox is not connected to the recordset that the rest of the form stores information in. I am using only to calculate data. I want to store that data in a field...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.