vigiw
Members-
Posts
100 -
Joined
-
Last visited
Never
Everything posted by vigiw
-
It does appear neater , but thanks for the suggestions.. good for future ref.
-
Easy enough if/else... thanks!
-
Hello.. I'm working on a switch statement with multiple possible conditions... Scenario 1: "(($var1 < 0) AND ($var2 < 0))" ... [Then something echoing both to 0] Scenario 2: "(($var1 < 0)" ... [Then something echoing var 1 to 0, and var 2's value] Scenario 3: "(($var2 < 0)" ... [Then Something echoing var 2 to 0, and var 1's value] Scenario 4 (Default): [Default/Normal Condition] - Simply echoes the values of both vars. When I try to get this going in a code, it simply doesn't work. Any ideas on how I can go about doing this, if possible in switch statements? I thought about if/else, but I have 4 different conditions to go through (if not Scenario 1, then 2... 3... 4... and I figured that was a bit much). Thanks.
-
Ok thank you! I think it's all set now. In my if/else, when its <= 0, I made it = 0, it was going into the negatives, when I thought it was a hyphen. Thanks!
-
It's probably because I changed one part, my fault for not mentioning it, I forgot. My points are based on 20, so I have another variable for $soc and $ec to multiply by 5 to get the percentage to plot on the map. That variable is just $soc_per and $ec_per printf('<img src="diamond_s%de%d.jpg" />', round($soc_per, -1), round($ec_per, -1)); But I think that's where it went wrong with the hyphens added in.
-
Thanks! I think its getting closer... but when the result is, for example for image diamond_s20e90.jpg - it will go to diamond_s-20e90.jpg But all of the files are saved as diamond_s#e#.jpg like above--but no hyphens like in the second image name. Again, thank you for helping!
-
Any ideas on how to make that work? ??? Thanks!
-
Thanks, but how would I tackle the rounding problem. Like if the user gets 86 for one of them or 43 for the other, i only have files for the Tens (e.g. 90 and 40)
-
Thanks for the help, but I couldn't go about doing the GD thing. So I made my own image files. It took a while (121 of them), but they are done. Is there a way, though, to take one of my numerical variables in the PHP script and say, for example (since there are two variables on this graph) if $soc = 40 and $ec = 60 - show image diamond_s40e60.jpg I realize that wasn't in a PHP script format, but that's because I'm not sure how I would include that with both. Also, my numerical values will not be exactly, let's use the example--40 soc---it might be: soc = 37, ec = 55. Any ideas how to script that? Thanks!
-
Ok thanks. Would it be possible to do this if I simply echoed the image in, or do I need to do something special. Right now I have, just to call the image up for blank display: echo "<img src=\"diamond.bmp\">\n";
-
Okay this is just a simple dot that I think would work. [attachment deleted by admin]
-
Yeah. Ok thanks
-
Ok, thanks for the response. I attached an example of my "diamond". As you see there are two scales there on the bottom of the sides. I have two variables to match the scales in my script. Would I be able to take my first variable, $soc for the Social scale and $ec for the Economic scale and make one point where they meet on the image here? [attachment deleted by admin]
-
Hmm... well, in that case, I must ask if I need to install GD or if its already part of PHP 5. And you now probably know of my serious lack of experience in GD.
-
Ok, I have a form which sends to a PHP script--that's all set and working (thanks to the help of forum members here! ). Now, I'm wondering on my PHP page, if I would be able to plot, kind of like a graph, onto an image. Here's what I'm thinking. I already have the code all setup with the image "echoed in" successfully, and I have two numerical values based on calculation on the form (which is done). My image looks like a graph, with an ongoing scale, in the shape of a diamond. (One scale running along the bottom to the left, and one from the bottom--to the right). Is there a way, based on the numerical result, for example, my two variables are $soc and $ec - could the script place them on the graph/image according to the scale? This might have been a bit confusing, so if you think this is possible, or if you need more input, just ask me. So any help would certainly be extremely appreciated. Thanks in advance!
-
Ok thanks everyone!
-
Ok... I've created a code for my need as described above, and the form's submit button will POST to my php file. But when I submit, the PHP page comes up blank. Here's the code: <?php $q1 = $_POST['q1']; $q2 = $_POST['q2']; $q3 = $_POST['q3']; $q4 = $_POST['q4']; $q5 = $_POST['q5']; $q6 = $_POST['q6']; $q7 = $_POST['q7']; $q9 = $_POST['q9']; $q13 = $_POST['q13']; $q17 = $_POST['q17']; $q18 = $_POST['q18']; $q19 = $_POST['q19']; $q8 = $_POST['q8']; $q10 = $_POST['q10']; $q11 = $_POST['q11']; $q12 = $_POST['q12']; $q14 = $_POST['q14']; $q15 = $_POST['q15']; $q16 = $_POST['q16']; $soc = $q1 + $q2 + $q3 + $q4 + $q5 + $q6 + $q7 + $q9 + $q13 + $q17 + $q18 + $q19; echo "You are" $soc; "% Socially" if ($var >= 50) echo " Liberal<br>"; else echo " Conservative<br>"; $ec = $q8 + $q10 + $q11 + $q12 + $q14 + $q15 + $q16; echo "You are" $ec; "% Fiscally (Economcially)" if ($var >= 50) echo " Liberal<br>"; else echo " Conservative<br>"; ?> Any ideas? Thanks in advance!
-
Hello, I've tried creating a form for a "quiz" (not a right-wrong quiz, but one which scores numbers of values for each selection for a specific result) using Javascript, but it didn't work out. I was wondering how, using the same form, I could go about doing this in PHP (if possible). I gave up on Javascript because it kept showing "NaN" for the calculated score, even though every value is a number, but some are negative (e.g. -5 for one value; 3 for another). Any help for this would certainly be appreciated. Thanks!
-
Why thank you for that link.
-
Ok, so with this-- UPDATE tbl SET fld = 'new data'; Should I replace the insert commands with-- $sql = "UPDATE" . "$table_name" SET field1 = 'new data'; $sql = "UPDATE" . "$table_name" SET field2 = 'new data'; and so on for each field?
-
Oh of course, update... But... Can I replace the following "Insert Into": $sql = "INSERT INTO `" . $table_name . "` to just Update Because after that line, i have all the fields listed, there is a number of them. Thanks.
-
Hello, I have a PHP form sending data to a MySQL table, and I am wondering if I can add some sort of code to the PHP page that will make the form data overwrite any potentially old data already in the table. This sounds simple enough, but I can't put my finger on it. ??? Thanks.
-
Can anyone else help? Thanks.
-
No, I mean this is a PHP Form that submits to a MySQL database, that is why it is PHP, and that part is done and working. I want to make an image map and allow the person submitting the form to click any hotspots they want, maybe they want multiple and click 3 of however many hotspots there may be. I would like those 3 or however many hotspots the person clicked, to be entered together in one field in this PHP form. So if the person click North, east, and south, I want it to appear in the form field: North, East, South I'm not sure how to implement this. Thanks
-
Hi, I have a PHP form with an image map. I would like the image map to output specific text for each hotspot, and enter it into a form field. Is this possible? And is it possible with multiple at one time without having to refresh? For example-- I would have a map of Massachusetts, and the map may contain northeast, southeast, west, and central as 4 different hotspots. And the form submitter happens to choose maybe 3 of these. How do I make it so the selections, and only the selections, all show together in the form field? I tried this with PHP but it only outputs 1 and refreshes for the next, and I was told to go for Javascript. I am inexperiened with Javascript and would appreciate some help. Thanks in advance!