Jump to content

cjenkins08

New Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by cjenkins08

  1. I am using the jscolor picker for the user to select color of text. I need multiple color pickers on one page. I am using these functions, because the HEX needs to be converted to RGB for output. Javascript: <script type="text/javascript"> function updateInfo(color) { document.getElementById('info-r').value = color.rgb[0]; document.getElementById('info-g').value = color.rgb[1]; document.getElementById('info-b').value = color.rgb[2]; } </script> <script type="text/javascript"> function updateInfo(top-color) { document.getElementById('top-info-r').value = color.rgb[0]; document.getElementById('top-info-g').value = color.rgb[1]; document.getElementById('top-info-b').value = color.rgb[2]; } </script> <script type="text/javascript" src="jscolor/jscolor.js"></script> HTML <input name="color" class="color{onImmediateChange:'updateInfo(this);'}" value="000000" size="9"> <input type="hidden" id="info-r" name="colorr"/> <input type="hidden" id="info-g" name="colorg"/> <input type="hidden" id="info-b" name="colorb"/> <input name="top-color" class="color{onImmediateChange:'updateInfo(this);'}" value="000000" size="9"> <input type="hidden" id="top-info-r" name="topcolorr"/> <input type="hidden" id="top-info-g" name="topcolorg"/> <input type="hidden" id="top-info-b" name="topcolorb"/> The first color picker is working Name = "color", this is the code pulled directly from jscolor's site. Any ideas why the second one is not pulling the RGB colors? Thanks
  2. Oh yeah, I'm confused alright. I'm still new, but I'm trying. Your post made sense to me and I made some progess, but have one more stumbling block. I have this html Color: <input name="color" class="color{onImmediateChange:'updateInfo(this);'}" value="66ff00"> R: <input id="info-r" name="colorr" size="2" />, G: <input id="info-g" name="colorg" size="2" />, B: <input id="info-b" name="colorb" size="2" /> and this in my php file $colorr = $_POST["colorr"]; $colorg = $_POST["colorg"]; $colorb = $_POST["colorb"]; So this is now working to pull the value of the RGB fields, the problem is when jscolor sets these values it seems unless it is a 0 or 1 they put a decimal in front of the number and some are longer than 3 digits. Example R 0.08999999999999997 G 1 B 0.286 So when I go to display these colors they are not recognized. How can I strip the decimal and the number in front of the decimal and also strip any digits past the decimal that are more than 3 places out Thanks for the help
  3. I am trying as you said and pulling them with $post using the following code in my php file $colorr = $_POST['color'][0]; $colorg = $_POST['color'][1]; $colorb = $_POST['color'][2]; The form is the same as original post except I added the name property to the input field <form action="100-text-no-color.php" name="genForm" method="post"> Color: <input name="color" class="color{onImmediateChange:'updateInfo(this);'}" value="66ff00"> R: <input id="info-r" size="2" />, G: <input id="info-g" size="2" />, B: <input id="info-b" size="2" /> <input type="submit" value="Generate Grid" style="height: 40px; width: 180px; font-size: 17px;" /> </form> When I go to display the variables, I am getting the first 3 digits of the HEX code as opposed to the RGB values. What am I doing wrong? Thanks
  4. I am working with this color picker code from jscolor.com and I am trying to use this particular example <script type="text/javascript" src="jscolor/jscolor.js"></script> <script type="text/javascript"> function updateInfo(color) { document.getElementById('info-r').value = color.rgb[0]; document.getElementById('info-g').value = color.rgb[1]; document.getElementById('info-b').value = color.rgb[2]; } </script> Color: <input class="color {onImmediateChange:'updateInfo(this);'}" value="66ff00"> R: <input id="info-r" size="2" />, G: <input id="info-g" size="2" />, B: <input id="info-b" size="2" /> After a submit button is clicked I need to assign variables to each of the RGB in PHP, but I'm not quite sure how to take those javascript values over to PHP. Any help is appreciated.
  5. Thank you for the reply. Looks easy enough, I will give this a try.
  6. I'm pretty new to PHP, but I am wondering what would be the easiest way to accomplish this. I am looking to have a form with two different lists(each list will have the name of one of the 50 states), the user will be able to select one state from each list. Each state on the list will have a picture of the state that is accociated with it. What is the easiest way to connect the name chosen with the image associated with it? Should this be in a Database? Should the images be stored direct or via a link to the URL of the images? Could the images just be stored in an Array? Using FPDF I have already styled a page, then I am then going to display the two state images in that same .pdf file.
  7. I'm here right now looking for a script that's already made. When I find time I plan on doing the homework, but for now I am looking for an already coded example of this.
  8. Hi, Looking for a pretty simple script. Need a drop down box for the user to select the number of text boxes that will appear. Once the text boxes load the user will be able to type their data in each text box and click Randomize. The text box date will be randomized and displayed back to the user. Can someone point me in the direction of a script that's already coded for this. 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.