Search the Community
Showing results for tags 'number'.
-
Here's a line. I want to add 100 more of same lines and increment the page numbers as shown below. I know I can just manually add 100 lines but Is there a way to do this with PHP that would make it easy? Or is this more of a javascript thing? // original $page1 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=1">1</a>'; // new $page1 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=1">1</a>'; $page2 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=2">2</a>'; $page3 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=3">3</a>'; $page4 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=4">4</a>'; $page5 = '<a href="?type='. $type_id .'&name='. $get_type_3_name_slug .'&page=5">5</a>'; ...etc
-
Struggling with creating the following: a. The authorized user can select one or both of the two available lottery services (in form of checkboxes) provided by your website. Generate six sets of LOTTO 6/49 numbers (sorted in ascending order) when option one, labeled as “LOTTO 6/49”, is checked. One set of “LOTTO 6/49” numbers consists of 6 unique numbers between 1 and 49 inclusively. Generate six sets of LOTTO MAX numbers (sorted in ascending order) when option two, labeled as “LOTTO MAX”, is checked. One set of “LOTTO MAX” numbers consists of 7 unique numbers between 1 and 49 inclusively. b. When the authorized user submits the form with one or both of the two available services checked, your web server will generate six sets of lottery numbers for each type accordingly and display these numbers of each type of lotteries to the user. Code so far: <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors','1'); if(!isset($_SESSION)){ session_start(); } ?> <html> <head> <title> Choose Tickets</title> </head> <body> <h2> Choose your tickets</h2> <?php if (filter_input(INPUT_POST,'form_tickets')){ if(!empty($_SESSION["tickets"])){ $tickets = array_unique( array_merge(unserialize($_SESSION["tickets"]), filter_input(INPUT_POST, 'form_tickets'))); $_SESSION["tickets"] = serialize($tickets); } else { $_SESSION["tickets"] = serialize(filter_input(INPUT_POST, 'form_tickets')); } echo "<p> Your tickets have been selected!</p>"; } ?> <form method="POST" action=""> <p><strong>Select your ticket(s):</strong><br> Lotto 6/49: <input type="checkbox" value="Lotto 6/49"><br /> Lotto Max: <input type="checkbox" value="Lotto Max"><br /> <p><input type="submit" value="submit"/></p> </form> </body> </html> I honestly don't really know what I'm doing.. This class isn't specifically php so he's going through it too quick for me to grasp/learn. I'm sort of going off examples he's given us but I can't seem to fit the pieces together to make this thing. Again, any help is greatly appreciated I have a vague idea of how it's all supposed to work but not sure of the commands to do it or how to structure it.
-
Hi! I was assigned to create a simple php game as a part of my grade, but i got stuck. I'm not really a php expert and this isnt really working. I managed to get some of the code/game working, but it's pointless imo. I'm looking for someone who would take 3 mins and fix this code for me. The game is called "Random number guessing game." From the title you can see that the game is not really complicated. Code: <html> <head> <title></title> </head> <body> <h1> Ugani Random!</h1> <? php if(isset($_POST['submit'])) $x = $_POST['x']; $num = $_POST['num']; $x = rand(1, 10) if($num<$x) { echo " Your number is higher! "<br /> } if($num==$x) { echo " Correct! Press Reset to try again! "<br /> } if($num>$x) { echo " Your number is lower! "<br /> } ?> <p> <form> <input type="number" name="quantity"> <br /> <button type="submit" value="<? echo $x?>">Submit</button> <button type="reset" value="<? echo $num?>">Reset</button> </form> </p> </body> </html> Computer basically generates a random number and compares it to the input part of <p> but it's not working as intended.
-
<script type="text/javascript" language="javascript"> function checkempty() { if(document.getElementById("title").value=="") { alert("Please enter title."); document.getElementById("title").focus(); return false; } if((document.getElementById("word_count").value>"3000") || (document.getElementById("word_count").value<"400")) { alert("Please enter less than 3000 or more than 400 words."); document.getElementById("word_count").focus(); return false; } return true; } </script> <form method="post" action="" name="my_form" id="theForm" onSubmit="return checkempty();"> <input size="80" id="title" type="text" name="title" value="" /> <textarea id="word_count" name="word_count"></textarea> <input type="submit" name="ok" value="submit" /> /*********this script is not working in the above code **************/ if((document.getElementById("word_count").value>"3000") && (document.getElementById("word_count").value<"400")) { alert("Please enter less than 3000 or more than 400 words."); document.getElementById("word_count").focus(); return false; } i am not good in javascript.. so please can any1 help me????
-
Hello...I'm developing one social networking kind of website where i wants to implement Rating...for posts, images, videos...just as like\unlike on facebook but rating will be in numbers from 1 to 10 using any drop-down box and it will finally add all the ratings given by different users for particular post...so please help asap......!!!!!!
-
Hello everyone. I tried to find out wether a number is armstrong or not.My logic was right but few php errors are creeping.I am new to PHP.So please help me out. Here is the code armstrong.php <html> <head> <title> Armstrong number </title> </head> <body> <?php $arm=0; $i; $k; $i=$_POST["i"]; $j=$i; while($j!=0) { $k=$j%10; $arm=$arm+($k*$k*$k); $j=$j/10; } if($i==$arm) {echo "Yes it is an Armstrong number";} else {echo "No,it is not an Armstrong Number";} ?> <form method="POST" action="armstrong.php"> <input type="text" name="i" /> <br> <br> <input type="submit" name="submit" /> <input type="reset" name="reset" /> </form> </body> </html> The error is it shows "Yes it is an Armstrong number" by default when we open armstrong.php in browser.And when we enter a number and click submit,every thing goes fine. Here is a screenshot of it. <hr> And also some php errors are visible(undefined variable.....). Please help.