Jump to content

hcdarkmage

Members
  • Posts

    326
  • Joined

  • Last visited

Everything posted by hcdarkmage

  1. PayPal has all the information you need to incorporate it into your website. On the main page, look carefully at what is offered, and make your decision accordingly. It is all there. Only you know what you need it to do, so only you can determine what services you need. Go through the documentation. Look through their tutorials. Ask them questions. They will help you get started.
  2. You would have to get an processing account, like PayPal, for taking the credit card information. You would also have to set up permissions for those users that buy the premium service. Generally it is free to set up these accounts, but they have a tendency to charge a small fee per transaction done. You would have to read the conditions of whatever processing service you are looking at.
  3. As far as I can tell, there is no compatibility issue. Checkout http://www.quirksmode.org/css/display.html for a list of display comands and what browsers they work in best.
  4. You may want to put your PHP code above your HTML code. When you submit the form, you are basically refreshing the page and it is read from top to bottom.
  5. There is no bar because you need to style the div to look like the bar. You have the code, but the style you are going to have to work with.
  6. The code haku gave you works. All you have to do is style it the way you want.
  7. I don't see why you can't. $varname = "<a href=\"".$url."\"><img src=\"".$page.".png\" alt=\"".$alt."\" /</a>";
  8. Are you using this code now to change the header? If you are, then it just randomly changes. You would probably want something like $page = "pagename"; $url = "pageurl"; $alt = "image alt" Print "<a href=\"".$url."\"><img src=\"".$page.".png\" alt=\"".$alt."\" /</a>"; Just name your images like Contact page = contact.png or whatever format you are using.
  9. Just trying to point out that neil.johnson may actually have your answer, if you'd look at what he is saying.
  10. Sometimes, the best things in life are free. With that being said, how would you feel if you where not getting your answers as fast because you couldn't join the group of payers?
  11. Here's another good one: http://www.razerzone.com/venom/
  12. You forgot your $ in front of your variable: $discounts = $_POST["discounts"]; $sizeof_arr = sizeof($discounts); if ( $sizeof_arr >0 ) // <--- Right here { } else { }
  13. No. Because you still need to see if those have empty values. What I gave you is just to see if the form was submitted. That's all. Then it checks to makes sure that there are scores.
  14. Try this: if ($submit != ""){ $goodtogo = true; if (($score_1 == "") || ($score_2 =="") || ($score_3 =="") || (!$calc)){ echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Oops, you forgot to supply some information. Please correct the problem below.</b></font><br>"); $goodtogo = false; } elseif ((!ereg("[0-9]",$score_1)) || (!ereg("[0-9]",$score_2) || (!ereg("[0-9]",$score_3)))){ echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please restrict your input to only numbers.</b></font><br>"); $goodtogo = false; } if ($goodtogo == true){ $avg=($score_1 + $score_2 + score_3)/3; if ($avg >= 29){ echo $total = 0; }else{ $total = ((29 - $avg) * (7/10)); } print("The freegumpher handicap is:". $total); } } I am not able to test this, but it should work. It checks to see if $submit has a value.
  15. Remove your else statement. Your basically telling your page that if there is something submitted, run the error coding and any other time run the calculations. if ($submit) { $goodtogo = true; if (($score_1 == "") || ($score_2 =="") || ($score_3 =="") || (!$calc)) { echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Oops, you forgot to supply some information. Please correct the problem below.</b></font><br>"); $goodtogo = false; } elseif ((!ereg("[0-9]",$score_1)) || (!ereg("[0-9]",$score_2) || (!ereg("[0-9]",$score_3)))) { echo("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please restrict your input to only numbers.</b></font><br>"); $goodtogo = false; } if ($goodtogo == true){ $avg=($score_1 + $score_2 + score_3)/3; if ($avg >= 29) { echo $total = 0; } else { $total = ((29 - $avg) * (7/10)); } print("The freegumpher handicap is:". $total); } }
  16. Your missing some end )'s : elseif ((!ereg("[0-9]",$score_1)) || (!ereg("[0-9]",$score_2)) || (!ereg("[0-9]",$score_3))) Don't forget to clean up your echo statements after that by putting the semicolon after each one: $avg=($score_1 + $score_2 + score_3)/3; if ($avg >= 29) { echo $total = 0; } else { echo $total= ((29 - $avg) * (7/10)); } print("The freegumpher handicap is:". $total);
  17. Apparently, it is rounding off properly, unless I read the equation wrong. According to my calculator, my result is 31.433525, essentially 31.43.
  18. I would like to thank you mjdamato, for you have solved a very perplexing situation. As for why there are so many hidden fields, it is because each value in the list is put into a database for users to change and use as they please (this works for a contact form). When I tried doing it with out the createhidden(), it wouldn't save to the database. Anyways, I would like to thank you for helping me with this problem. Everything works great now.
  19. Try removing the WEB_ROOT from your links.
  20. If the title is confusing, I hope my explanation clarifies it. I have a JS function that creates a hidden input to store values from the form after the "add" button is clicked. Now, my problem is, what if the customer decides they don't like that value? How can I remove the hidden field after it has been created? Here is the code for the form: <tr id="tbrowOption" style="display:none"> <td valign="top"><? echo $lang['contactform']['fieldoptions'] ?></td> <td> <table border=0 cellpadding=0 cellspacing=0 width=98%> <tr> <td><input name="optionvalue" id="optionvalue" style="width:160px"> <input type="button" value="<? echo $lang['contactform']['add'] ?>" onclick="addOption(); createhidden();"> <input type=button value="<? echo $lang['contactform']['del'] ?>" onclick="deleteOption()"></td> </tr> <tr> <td><select size=5 name="options1" id="options1" style="width:230px"> <?php if (($pageaction=="edit" || $pageaction=="update") && $field_id !=""){ foreach($options as $value){ echo "<option name=\"options[]\" id=\"options[]\" value=".$value.">".$value."</option>"; } } ?> </select> <?php if (($pageaction=="edit" || $pageaction=="update") && $field_id !=""){ foreach($options as $value){ echo "<input type=\"hidden\" name=\"options[]\" id=".$value." value=".$value." />"; } } ?></td> </tr> </table> </td> </tr> And here is the JS code that creates the hidden field and stuff: function trimString(input) { var output = input; while (output.substring(0, 1) == ' ') { output = output.substring(1, output.length); } while (output.substring(output.length - 1, output.length) == ' ') { output = output.substring(0, output.length - 1); } return output; } function addOption() { var textbox = document.getElementById('optionvalue'); var listbox = document.getElementById('options1'); var inList = false; var myText = trimString(textbox.value); var myOption; if(myText != '') { for(var i=0; i<listbox.options.length; i++) { if(myText.toLowerCase() == listbox.options[i].text.toLowerCase()) { inList = true; break; } } if(!inList) { myOption = new Option(myText, myText); listbox.options[listbox.options.length] = myOption; } } } function createhidden(){ var vValue = document.getElementById("optionvalue").value; var input = document.createElement("input"); if (vValue != '') { input.setAttribute("type", "hidden"); input.setAttribute("name" , "options" + "[]"); input.setAttribute("value", vValue); input.setAttribute("id", vValue); document.getElementById("thisform").appendChild(input); } } function deleteOption() { var listbox = document.getElementById('options1'); for(var i=0; i<listbox.options.length; i++) { if(listbox.options[i].selected) { listbox.options[i] = null; } } } Any help or ideas would be appreciative.
  21. Well, It looked harder then it was. After much Google trial and error I found a solution: <tr id="tbrowOption" style="display:none"> <td valign="top"><?php echo $lang['contactform']['fieldoptions'] ?></td> <td> <table border=0 cellpadding=0 cellspacing=0 width=98%> <tr> <td><input name="optionvalue" id="optionvalue" style="width:160px"> <input type="button" value="<?php echo $lang['contactform']['add'] ?>" onclick="addOption()"> <input type=button value="<?php echo $lang['contactform']['del'] ?>" onclick="deleteOption()"></td> </tr> <tr> <td><select size=5 name="optionslist" id="optionslist" style="width:230px"> <?php if (($pageaction=="edit" || $pageaction=="update") && $field_id !=""){ foreach($options as $value){ echo "<option value=".$value.">".$value."</option>"; } } ?> </select></td> </tr> </table> </td> </tr> And the JS code: function trimString(input) { var output = input; while (output.substring(0, 1) == ' ') { output = output.substring(1, output.length); } while (output.substring(output.length - 1, output.length) == ' ') { output = output.substring(0, output.length - 1); } return output; } function addOption() { var textbox = document.getElementById('optionvalue'); var listbox = document.getElementById('optionslist'); var inList = false; var myText = trimString(textbox.value); var myOption; if(myText != '') { for(var i=0; i<listbox.options.length; i++) { if(myText.toLowerCase() == listbox.options[i].text.toLowerCase()) { inList = true; break; } } if(!inList) { myOption = new Option(myText, myText); listbox.options[listbox.options.length] = myOption; } } } function deleteOption() { var listbox = document.getElementById('optionslist'); for(var i=0; i<listbox.options.length; i++) { if(listbox.options[i].selected) { listbox.options[i] = null; } } }
  22. Any ideas? Do I need to clarify anything?
  23. Ok, here we go. I have a form that lets users input options into the database for things like radio buttons, checkboxes and dropdowns. Now, my problem is I can't get the JS to populate the proper area when they click the "add" button. Here is the code: <tr id=tbrowOption style="display:none"> <td valign=top><?php echo $lang['contactform']['fieldoptions'] ?></td> <td> <table border=0 cellpadding=0 cellspacing=0 width=98%> <tr> <td><input name=optionvalue style="width:160px"> <input type=button value="<?php echo $lang['contactform']['add'] ?>" onclick="addOption(document.thisform.optionvalue.value); document.thisform.optionvalue.focus();"> <input type=button value="<?php echo $lang['contactform']['del'] ?>" onclick="deleteOption()"></td> </tr> <tr> <td><select size=5 name=options style="width:230px" onchange="populateItem(this.options[this.selectedIndex].index)"></select></td> </tr> </table> </td> </tr> And the JS: function addOption(optionvalue){ var sAgent = navigator.userAgent.toLowerCase() ; //for ie browser if (sAgent.indexOf('msie')!=-1 && sAgent.indexOf('opera')==-1) { if ((optionvalue.length==0) ||(optionvalue==null)) { alert("<? echo $lang['contactform']['mustenteroption'] ?>"); }else { if (optionvalue != ""){ var opt = new Option(optionvalue,optionvalue); document.thisform.option.options.add(opt); var oNewItem = document.createElement("INPUT"); document.thisform.children(0).insertAdjacentElement("afterBegin",oNewItem); oNewItem.type = "TEXT"; oNewItem.name = "options[]"; oNewItem.value= optionvalue; oNewItem.style.display= "none"; document.thisform.optionvalue.value=""; } } //for gecko and other browser, else if (navigator.product == "Gecko" && navigator.productSub >= 20030210){ } else { if ((optionvalue.length==0) ||(optionvalue==null)) { alert("<? echo $lang['contactform']['mustenteroption'] ?>"); }else { if (optionvalue != ""){ var opt = new Option(optionvalue,optionvalue); document.thisform.option.options.add(opt); var input2 = document.createElement('INPUT'); input2.id = optionvalue; input2.type = "text"; input2.name = "options[]"; input2.value = optionvalue; thisform.appendChild(input2); input2.style.display="none"; document.thisform.optionvalue.value = ""; i = document.thisform.option.length-1; multiOption[i] = optionvalue; } } } } function deleteOption(){ var sAgent = navigator.userAgent.toLowerCase() ; //for ie browser if (sAgent.indexOf('msie')!=-1 && sAgent.indexOf('opera')==-1) { var optionlist = document.thisform.option; for(var i=0; i<optionlist.options.length; i++) { if(optionlist.options[i].selected && optionlist.options[i] != "") { document.thisform.elements(optionlist.options.length-i-1).removeNode(); optionlist.options[i]= null; break; } multiOption.splice(selecteditem, 1); } //for gecko and other browser, else if (navigator.product == "Gecko" && navigator.productSub >= 20030210){ } else { var optionlist = document.thisform.option; for(var i=0; i<optionlist.options.length; i++) { if(optionlist.options[i].selected && optionlist.options[i] != "") { optionlist.options[i]= null; break; } } thisvalue = multiOption[selecteditem]; d_nested = document.getElementById(thisvalue); throwaway_node = thisform.removeChild(d_nested); multiOption.splice(selecteditem, 1); } } function populateItem(index) { selecteditem=index; } Any help with this would be appreciated.
  24. First off, according to the tutorial, your $num=0; is in the wrong place. If you look at the code it looks like this: if (isset($_POST['register'])) { $username = trim(strip_tags(stripslashes($_POST['username']))); } else { $random = rand(1,1000); $username = 'Anon'. $random; } //end of if/else conditional</strong> $num = 0; $_SESSION['user'] = $username; // username $_SESSION['score'] = 0; // score set to 0 $_SESSION['correct'] = array(); // to hold the user's correct answers $_SESSION['wrong'] = array(); // to hold the user's incorrect answers $_SESSION['finished'] = 'no'; // they haven't finished the quiz yet Without knowing your full if-else statement, no one can tell what is going on in that code. It could be that it isn't even calling that if-else statement at all. Plus the includes and placement of your code is important. The tutorial uses 3 pages. it is hard to tell from the snippets of code that you provide whether you have them in the right pages to begin with.
×
×
  • 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.