Jump to content

keepAway

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

keepAway's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Still can't find a proper solution for my problem, any others ideas?
  2. No 4, 9, 9 isn`t good, but your example seems to be a start for me.. he outputs all possible combinations with 4 in it... From now on, i only have 4 combinations left and i need to find a way to output them to ..
  3. i have an array with 5 numbers... $numbers = array(1 => 4; 2 => 26; 3 => 15; 4 => 36 5 => 9); I need a method to combine them in sets of three.. For example: 4, 26, 15 4, 26, 36 4, 26, 9 and so on ... Have ten possible combinations. Any idea or advice of how i could do this...?
  4. <?php session_start(); $i=1; while($i<=26){ $i++; $nr = rand(1, 1500); echo $nr."<br />"; } ?> How could i check if a number is randomed twice before i put them into database?
  5. it`s working, thanks.. As i told you, i`m pretty new in this language. I have a long link and using a button will redirect me out of the page after is submited... this is my explanation. Once again, thank you.
  6. if i`m not using a submit input will return an undefined index ... Notice: Undefined index: firstinput in C:\xampp\htdocs\targovisteni\admin\test.php on line 14 Notice: Undefined index: secondinput in C:\xampp\htdocs\targovisteni\admin\test.php on line 14
  7. This is a basic example of what i`m trying... and work`s fine.. <form name='validate' action='#'> <input type='text' name='firstinput' /> <input type='text' name='secondinput' /> <input type='submit' name='input' value='Add' /> </form> <?php if(isset($_GET['input'])) { echo $_GET['firstinput']." - ".$_GET['secondinput']; } ?> but i want to submit this inputs on this way.. <form name='validate' action='test.php'> <input type='text' name='firstinput' /> <input type='text' name='secondinput' /> <a href='test.php?input=ok'>Add</a><br /> </form> <?php if(isset($_GET['input']) && $_GET['input'] == "ok") { echo $_GET['firstinput']." - ".$_GET['secondinput']; } ?> i`m pretty new in this language and i`m doing my best to learn it, so is there any chance to make him work?
  8. $toateLigile = array("Promotie Sud", "Promotie Nord", "Onoare Sud", "Onoare Nord", "Divizia D", "Divizia C1", "Divizia C2", "Divizia C3", "Divizia C4", "Divizia C5", "Divizia C6", "Divizia C7", "Divizia B1", "Divizia B2", "Divizia A"); echo "<select name='toateLigile'>"; echo "<option value=''> ############ </option>"; for ($i=0; $i<=14; $i++) echo "<option value='".$toateLigile[$i]."'>".$toateLigile[$i]."</option>"; echo "</select>"; How do i make this piece of code stay selected at the previouse option after i send the input and the page is refreshed.
  9. wildteen88 u`re the man... the password field was set at 30 characters.. thx ..
  10. I can not handle with this function, will allways return 0 mysql_num_rows and i`m not able to login. <?php session_start(); mysql_connect("localhost", "root", ""); mysql_select_db("proiect"); include("inc/functii.php"); echo "<form method='post' name='login'> <table cellspacing='1' cellpadding='2' border='0' > <tr> <td colspan='2' align='center' height='55'> Admin Login </td> </tr> <tr> <td id='paddingbot' colspan='2'> Username </td> </tr> <tr> <td id='paddingtop' colspan='2'><input type='text' name='username' size='33'/></td> </tr> <tr> <td colspan='2'></td> </tr> <tr> <td id='paddingbot' colspan='2'> Password </td> </tr> <tr> <td id='paddingtop' colspan='2'><input type='password' name='password' size='33' /></td> </tr> <tr> <td id='rem_me'><input type='checkbox' name='remember_me' /></td> <td> Remember me </td> </tr> <tr> <td align='right' colspan='2'><input type='submit' name='login' value='Login >' /></td> </tr> <tr> <td colspan='2' align='center'>"; checkLogin(); echo "</tr> </table> </form>"; ?> <?php function checkLogin () { if (isset($_POST['login'])) if (($_POST['username']) == '') { echo "Please, complete the field for username."; } elseif (($_POST['password']) == '') { echo "Please, complete the field for password."; } elseif (($_POST['username'] !== '') && ($_POST['password']) !== '') { $username = $_POST['username']; $password = md5($_POST['password']); $result = mysql_query("SELECT * FROM admin WHERE username='".$username."' AND password='".$password."'") or die ("Error:".mysql_error()); $nr = mysql_num_rows($result); if ($nr < 1) { echo $nr; } else { $_SESSION['username'] = $username; $_SESSION['password'] = $password; echo "Welcome".$username; } } } ?>
  11. Thanks for the answers, i eventually realized how to do it after lots of attempts. mysql_query ("UPDATE liga1 SET puncte='$pctsteaua'+'3', m='$msteaua'+'1', v='$vsteaua'+'1' WHERE echipa='Steaua' ");
  12. How can i do the sum of two numbers inside of a mysql quory, or if this is possible? while($rand = mysql_fetch_array($cerereSQL)) { $pctsteaua = $rand['puncte']; echo "<pre>"; print_r ($rand); echo "</pre>"; } First i have this variable $pctsteaua who will return me a number. This number i need to use it here. mysql_query ("UPDATE liga1 SET puncte='$pctsteua + 3', m='1', v='1' WHERE echipa='Steaua' "); The problem is, how i do the math inside this myslq quory to work properly and update my database not with a submited number, but with the sum between the $pctsteaua variable + 3.
  13. Check this out. <form action="" method="post"> <table cellspacing=2 cellpadding=2 border=0 align=center> <tr><td><strong>Site name: </strong></td><td><input type="text" name="sitename" /></td><td>remember to put .php</td></tr> <tr><td><strong>Title: </strong></td><td colspan=2><input type="text" name="title" /></td></tr> <tr><td colspan=3><strong>Do you like this website? </strong></td></tr> <tr><td colspan=3><input type="radio" name="likeit" value="Yes" checked="checked" /> Yes</td></tr> <tr><td colspan=3><input type="radio" name="likeit" value="No" /> No</td></tr> <tr><td colspan=3><input type="radio" name="likeit" value="Not sure" /> Not sure</td></tr> <tr><td><strong>Your comments: </strong></td></tr> <tr><td colspan=3><textarea name="comments" rows="10" cols="40"></textarea></td></tr> <tr><td colspan=3 align=center><input type="submit" name="submit" value="Send it!"></td></tr> <tr><td align=center colspan=3><?php if (isset($_POST['submit'])) echo "Your replay has been added.";?></td></tr> </form> <?php if (isset($_POST['submit'])) { $comment = "Site name: ".$_POST['sitename']." Title: ".$_POST['title']." Do you like the website: ".$_POST['likeit']." Your comments: ".$_POST['comments']; $file = "replays.txt"; $border = "\r\n----------------------------------------\r\n"; if (!file_exists($file)) file_put_contents($file, $comment); else { $handle = fopen($file, "a+"); fwrite($handle, $border.$comment); fclose($handle); } } ?>
  14. <form name="f1" form method="post" action=""/> <input type="text" name="hp1" size="20"/> <input type="submit" name="submit" value="Submit"> </form> <?php if (isset($_POST['submit'])) { if (empty($_POST['hp1'])) { echo "Empty field"; } else echo $_POST['hp1']; } ?>
×
×
  • 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.