Enjoy an ad free experience by logging in. Not a member yet?
Register .
11-14-2011, 02:20 PM
PM User |
#1
New to the CF scene
Join Date: Nov 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Math in html or PHP using mysql database
I am working on a site through godaddy since I have no coding background.
I have a mysql database through them, and it puts onto the website page 4 columns.
First column is text for various criteria, the second column is Weight (would be percentages between 0 and 100, and the whole column would have to add up to 100%). The third column is a rating from 0 to 10. The fourth column would take columns 2 and 3 and multiply them together, and the sum of all those criteria should be at the bottom.
How do I do the mathematical computations?
Also, after a user hits "submit" to post his/her weights and ratings, how would I have the summed total of all the multiplications show up on the page? Is there a way to do that solely in the PHP/html section along with the mysql?
The criteria would be fixed (same for all users) but what they rate and weight would be inputted by them.
11-14-2011, 02:25 PM
PM User |
#2
Senior Coder
Join Date: Aug 2010
Location: High Point, NC
Posts: 3,325
Thanks: 5
Thanked 363 Times in 360 Posts
You'll need to use a server side like php to do mathematical calculations.
Is this a homework assignment? lol Either way, if you post your code so far, someone might be able to help more.
__________________
Teed
11-14-2011, 02:47 PM
PM User |
#3
New to the CF scene
Join Date: Nov 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
I will see if I can get it out of godaddy, which is mostly click and drag.
Thanks,
11-15-2011, 12:53 PM
PM User |
#4
New to the CF scene
Join Date: Nov 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Godaddy said I can't get the script code but I could use java or css to manipulate the way it appears. Right now it is a list of rows such as:
Color Weight
Color Rating
Style Weight
Style Rating
etc
And the input boxes they assigned to them are super long.
I wanted it to be like this...
Color Weight (text box) Color Rating (text box)
Style Weight (text box) Style Rating (text box)
And so on, with each row having the two numbers multiplied by each other, and then summed on the bottom for a total overall score. All I would truly need to get back to the mysql database is the overall sum, and the individual ratings for each category. I wouldn't need the weights (but it's ok if they would have to go back).
And is a script the way I would have to do it? Could I make a table and somehow get the data back to the database?
11-15-2011, 03:31 PM
PM User |
#5
Senior Coder
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
it would be a lot more simple if you linked the page and posted a screenshot of what you want it to look like
(that way we can see live example and what you want the end result to be)
11-16-2011, 12:43 PM
PM User |
#6
New to the CF scene
Join Date: Nov 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Well a developer gave me the raw code to enter to create a 2 column grid, but I'm not sure where to put it. Here is the code he gave me. Does anyone know where it would go? He had said in the <head> document.
<style type="text/css">
/* Set width of form controls and that they should be floated */
.Data_Central_Control {
width: 305px;
float: left;
}
/* Odd widgets need to start on the left again. If you have more than
11 controls you will need to update this */
.Data_Central_Control1,
.Data_Central_Control3,
.Data_Central_Control5,
.Data_Central_Control7,
.Data_Central_Control9,
.Data_Central_Control11 {
margin-right: 10px;
clear: both;
}
/* Align submit button to the left */
.Data_Central_Button_Container {
clear: both;
text-align: left;
}
</style>
Thanks
11-17-2011, 04:05 PM
PM User |
#7
New to the CF scene
Join Date: Nov 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Here is the code I need to enter the above code into. Anyone know exactly where?
/**
* @file
* @project 678
* @package sftheme
* @site app1
*/
/**
* ------------------------------------------------------------------
* @section TYPOGRAPHY
* ------------------------------------------------------------------
*/
h1 {
font-size:2em;
font-weight:normal;
margin:0 0 0.75em;
color:#000000;
}
h2 {
font-size:1.6em;
font-weight:normal;
margin:1.3em 0 0.94em;
color:#555555;
}
h3 {
font-size:1.25em;
font-weight:bold;
margin:1.65em 0 1.2em;
color:#000000;
}
h4 {
font-size:1.1em;
font-weight:normal;
margin:1.5em 0;
color:#555555;
}
h5 {
font-size:0.9em;
font-weight:normal;
margin:1.67em 0;
color:#000000;
}
h6 {
font-size:0.9em;
font-weight:normal;
font-style:italic;
margin:1.67em 0;
color:#000000;
}
p {margin:0 0 1.5em;padding:0;line-height:1.5;}
form {margin:0 0 1.5em;padding:0;}
blockquote {margin:1.5em;}
sup, sub {line-height:0;}
address {margin:0 0 1.5em;}
pre, code {margin:1.5em 0;white-space:pre;}
pre, code, tt {line-height:1.5;}
caption {margin:0; padding:.5em;}
/**
* ------------------------------------------------------------------
* @section MAIN AREA
* ------------------------------------------------------------------
*/
body {
font-family:Arial, Helvetica, FreeSans, sans-serif;
font-size:12px;
margin:0px;
padding:0px;
background-image:url(images/678_grad.png);
background-repeat:repeat-x;
}
html, body {
height:auto !important;
}
a:link,
a:visited,
a:hover {
text-decoration:none;
}
.sf_wrapper {
width:990px;
min-height:1%;
height:auto !important;
height:1%;
margin:0 auto;
position:relative;
z-index:1;
}
.sf_wrapper:after {
content:".";
clear:both;
height:0;
visibility:hidden;
display:block;
}
.sf_main_wrapper {
width:990px;
min-height:1%;
height:auto !important;
height:1%;
background-image:url(images/678_whitegrad_base.png);
background-repeat:repeat;
}
.sf_main_wrapper:after {
content:".";
clear:both;
height:0;
visibility:hidden;
display:block;
}
.sf_main {
min-height:1%;
height:auto !important;
height:1%;
background-image:url(images/678_whitegrad.png);
background-repeat:no-repeat;
}
.sf_main:after {
content:".";
display:block;
clear:both;
visibility:hidden;
height:0;
}
.sf_region6 {
padding:30px 20px 40px 30px;
min-height:200px;
height:auto !important;
height:200px;
}
.sf_region6:after {
content:".";
clear:both;
height:0;
visibility:hidden;
display:block;
}
/**
* @subsection header
*/
.sf_region1 {
min-height:1%;
height:auto !important;
height:1%;
width: 990px;
margin:0 auto;
}
.sf_region1:after {
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
.sf_main_header {
font-size:26px;
font-weight:bold;
padding:25px 0;
min-height:1%;
height:auto;
}
* html .sf_main_header {
height:1%;
}
.sf_main_header:after {
content:".";
display:block;
visibility:hidden;
clear:both;
height:0;
}
/**
* @section navigation
*/
.sf_region2 {
min-height:1%;
height:auto !important;
height:1%;
width:970px;
padding: 0 20px 0 0;
}
.sf_region2:after {
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
.sf_navigation {
margin: 0px;
float:right;
}
.sf_navigation .widget_header{
display:none;
}
.sf_navigation ul {
margin: 0;
padding: 0;
}
.sf_navigation ul:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
height:0px;
}
.sf_navigation ul li {
float: left;
list-style: none;
margin: 0 0 0 20px;
padding: 0;
white-space: nowrap;
min-width:1%;
width: auto;
}
.sf_navigation ul li a {
display: block;
margin:0px;
padding:12px 0 13px;
text-decoration: none;
font-size:11px;
min-width:1%;
width: auto;
}
* html .sf_navigation ul li,
* html .sf_navigation ul li a {
width:1%;
}
/**
* @section subnav
*/
.sf_navigation .subnav {
border-style:solid;
border-width:1px;
left: -999em;
list-style: none;
line-height: 1;
margin: -1px 0 0;
padding: 0px;
position: absolute;
width: 154px;
z-index:1000;
}
.sf_navigation .subnav li {
float: left;
margin:0;
padding:0;
width: 154px;
white-space:normal;
}
.sf_navigation .subnav li a {
display: block;
height:auto;
padding:5px 12px 6px;
width: 130px;
white-space:normal;
font-size:11px;
text-transform:none;
}
#Nav1 li:hover ul,
#Nav1 li.sfhover ul {
left: auto;
}
#Nav1 iframe {
position: absolute;
left: 0;
top: 0;
z-index: 0;
filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
}
#Nav1 li:hover, #Nav1 li.hover {
position: static;
}
/**
* @subsection content
*/
.sf_content {
min-height:1%;
height:auto !important;
height:1%;
}
.sf_content:after {
content:".";
display:block;
clear:both;
visibility:hidden;
height:0;
}
.sf_pagetitle {
font-weight:normal;
font-size:26px;
padding:0px 10px;
margin-bottom:15px;
}
.sf_pagetitle h1 {
font-size:26px;
font-weight:normal;
margin:0;
color:inherit;
}
.sf_extra12 {
display:none;
}
/**
* @subsection footer
*/
.sf_region9 {
min-height:1%;
height:auto !important;
height:1%;
width: 100%;
clear:both;
}
.sf_region9:after {
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
.sf_footer {
padding:12px 20px 13px;
font-size:11px;
text-align:right;
}
/**
* @subsection banner
*/
.sf_region10 {
font-size:10px;
text-align:center;
clear:both;
}
.sf_banner {
padding:10px;
}
.sf_banner #bannerImage {
padding:5px;
}
/**
* @subsection buttons
*/
.btn {
font-size: 11px;
font-family:Arial, Helvetica, FreeSans, sans-serif;
cursor: pointer;
margin: 3px 0;
padding: 2px 4px 3px;
border:none;
}
/**
* @subsection flower container
*/
.sf_extra9 {
width:100%;
height:255px;
margin-top:-150px;
z-index:0;
position:relative;
background-image:url(images/678_flowers.png);
background-repeat:repeat-x;
background-position:bottom left;
}
/**
* ------------------------------------------------------------------
* @section WIDGETS
* ------------------------------------------------------------------
*/
.widgetset {
float:right;
width:180px;
display:none;
font-size:11px;
}
.widgetset .widget {
margin-bottom:20px;
min-height:1%;
height:auto !important;
height:1%;
}
.widgetset .widget_header {
margin:0 0 10px 0;
font-size:18px;
font-weight:normal;
}
.widgetset .widget_header a:link,
.widgetset .widget_header a:visited,
.widgetset .widget_header a:hover{
text-decoration:none;
}
.widgetset .widget_content {
width:180px;
overflow:hidden;
}
.widgetset .HomeLink .widget_content {
margin:0px;
padding:0px;
}
.widgetset .widget_content ul,
.widgetset .widget_content ol {
margin:0px;
padding:0px;
list-style:none;
}
.widget li{
margin:0px;
padding:0px 0px 10px;
}
.widgetset label{
margin:0px;
padding:0px;
display:block;
}
.widgetset form{
margin:0px;
padding:0px;
}
.widgetset .form_item {
margin:0px;
padding:0px 0px 6px;
}
.widgetset input[type=text] {
width:172px !important;
}
.widgetset select {
width:177px !important;
}
* html .widgetset select {
width:139px !important;
}
/**
* ------------------------------------------------------------------
* @section IE6 PNG FIXES
* ------------------------------------------------------------------
*/
* html body {
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "images/spacer.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));;
}
* html .sf_main_wrapper {
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "images/spacer.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='scale')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));;
}
* html .sf_main {
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "images/spacer.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));;
}
* html .sf_region6 {
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "images/spacer.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='scale')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));;
}
* html .sf_extra9 {
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "images/spacer.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));;
}
* html input,
* html textarea,
* html a {
position:relative;
}
* html .sf_region2 {
position:relative;
z-index:2;
}
11-17-2011, 04:41 PM
PM User |
#8
New Coder
Join Date: Sep 2011
Location: United Kingdom
Posts: 72
Thanks: 2
Thanked 3 Times in 3 Posts
Ok, that is all CSS code that goes into your header tag <head></head> in your website.
You can do it this way by: <style type="text/css"> ... all the code above ... </style>
Or Good practice would be to link it: <head> ...
<link rel="stylesheet" href="style.css" type="text/css" />
...</head>
And then Copy all of the above CSS code and past it into a text file. Rename the text file to "style.css".
Save the text file in the same location as the html file. If everything worked fine and you open the html file in a browser window, it should be able to assign the styles for this page.
Good luck !
Last edited by clausrei; 11-17-2011 at 04:44 PM ..
Users who have thanked clausrei for this post:
11-17-2011, 06:19 PM
PM User |
#9
New to the CF scene
Join Date: Nov 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Thank you very much. I am so new to this I was trying everything but that. But it does make sense. I will try it tonight.
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 03:34 PM .
Advertisement
Log in to turn off these ads.