Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

<html> <body> <form> <select name="dp"> <?php mysql_connect("localhost","root",null); mysql_select_db("stu"); $but=$_REQUEST['but']; $dp=$_REQUEST['dp']; if($but=="ok") {

php

<html>
<body>
<form>
<select name="dp">
<?php
mysql_connect("localhost","root",null);
mysql_select_db("stu");
$but=$_REQUEST['but'];
$dp=$_REQUEST['dp'];

if($but=="ok")
{
		$res=mysql_query(" select classname from class ");
		while($rec=mysql_fetch_array($res))
		{ 
		echo ".$rec[classname]. ";
		}
}
?>
</select>

<select name="dp">
<?php
if($but=="ok")
{
		$c=0;
		$res=mysql_query(" select stu_name from student ");
		while($rec=mysql_fetch_array($res))
		{
		echo "<option>.$rec[stu_name].<option>";
		}
}
?>
</select>
<input type="button" name="but" value="ok">
<form>
</body>
</html>

<? /*************************************************************** * register0.php * * Computer Science 50 * David J. Malan * * Dumps contents of $_POST. **********************************************************

php

<? 
    /*************************************************************
     * froshims0.php
     *
     * David J. Malan
     * [email protected]
     *
     * Implements a registration form for Frosh IMs.
     * Submits to register0.php.
     *****************************************************************/
?>

<!DOCTYPE html>

<html>
  <head>
    <title>Frosh IMs</title>
  </head>
  <body>
    <div style="text-align: center">
      <h1>Register for Frosh IMs</h1>
      <br><br>
      <form action="register0.php" method="post">
        <table style="border: 0; margin-left: auto; margin-right: auto; text-align: left">
          <tr>
            <td>Name:</td>
            <td><input name="name" type="text"></td>
          </tr>
          <tr>
            <td>Captain:</td>
            <td><input name="captain" type="checkbox"></td>
          </tr>
          <tr>
            <td>Gender:</td>
            <td>
              <input name="gender" type="radio" value="F"> F  
              <input name="gender" type="radio" value="M"> M
            </td>
          </tr>
          <tr>
            <td>Dorm:</td>
            <td>
              <select name="dorm">
                <option value=""></option>
                <option value="Apley Court">Apley Court</option>
                <option value="Canaday">Canaday</option>
                <option value="Grays">Grays</option>
                <option value="Greenough">Greenough</option>
                <option value="Hollis">Hollis</option>
                <option value="Holworthy">Holworthy</option>
                <option value="Hurlbut">Hurlbut</option>
                <option value="Lionel">Lionel</option>
                <option value="Matthews">Matthews</option>
                <option value="Mower">Mower</option>
                <option value="Pennypacker">Pennypacker</option>
                <option value="Stoughton">Stoughton</option>
                <option value="Straus">Straus</option>
                <option value="Thayer">Thayer</option>
                <option value="Weld">Weld</option>
                <option value="Wigglesworth">Wigglesworth</option>
              </select>
            </td>
          </tr>
        </table>
        <br><br>
        <input type="submit" value="Register!">
      </form>
    </div>
  </body>
</html>

Execute PHP Online

php

<?php
phpinfo();
?>

Brilliant POTW Sep4 Intermediate #3

php

<?php 
$arr = array('2'=>0,'3'=>0,'4'=>0,'5'=>0);
for($i=1;$i<=120;$i++){
    $sum = 0;
    for($j=1;$j<=$i;$j++){
        $sum += $j;
    }
    if($sum%2==0){
        $arr[2]++;
    }
    if($sum%3==0){
        $arr[3]++;
    }
    if($sum%4==0){
        $arr[4]++;
    }
    if($sum%5==0){
        $arr[5]++;
    }
}
asort($arr);
$arr = array_keys($arr);
echo 'answer: '.$arr[0];

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.