PHP Javascript form elemanları tanımıyor

0 Cevap php

HTML: saucydares.freehostia.com/saucy.php Ben sadece eklemek gerekir hiçbir görüntü varken, site yetişkin temalar içerir ve böylece güvenli iş değildir.

PHP:

    <?php

    mysql_connect("mysql4.freehostia.com", sebsal2_db, "");

    function him()
    {
    $HIMquery = "SELECT dares FROM sebsal2_db.him UNION SELECT dares FROM sebsal2_db.other ORDER BY Rand() LIMIT 1";
    $HIMresult = mysql_query($HIMquery);
    while ($HIMrow = mysql_fetch_array($HIMresult, MYSQL_NUM)) {echo "$HIMrow[0]";}
    }

    function her()
    {
    $HERquery = "SELECT dares FROM sebsal2_db.her UNION SELECT dares FROM sebsal2_db.other ORDER BY Rand() LIMIT 1";
    $HERresult = mysql_query($HERquery);
    while ($HERrow = mysql_fetch_array($HERresult, MYSQL_NUM)) {echo "$HERrow[0]";}
    }

    function double()
    {
    $DOUBLEquery = "SELECT dares FROM sebsal2_db.double ORDER BY Rand() LIMIT 1";
    $DOUBLEresult = mysql_query($DOUBLEquery);
    while ($DOUBLErow = mysql_fetch_array($DOUBLEresult, MYSQL_NUM)) {echo "$DOUBLErow[0]";}
    }

    function himlong()
    {
    $HIMLONGquery = "SELECT dares FROM sebsal2_db.him2 UNION SELECT dares FROM sebsal2_db.other2 ORDER BY Rand() LIMIT 1";
    $HIMLONGresult = mysql_query($HIMLONGquery);
    while ($HIMLONGrow = mysql_fetch_array($HIMLONGresult, MYSQL_NUM)) {echo "$HIMLONGrow[0]";}
    }

    function herlong()
    {
    $HERLONGquery = "SELECT dares FROM sebsal2_db.her2 UNION SELECT dares FROM sebsal2_db.other2 ORDER BY Rand() LIMIT 1";
    $HERLONGresult = mysql_query($HERLONGquery);
    while ($HERLONGrow = mysql_fetch_array($HERLONGresult, MYSQL_NUM)) {echo "$HERLONGrow[0]";}
    }

    function doublelong()
    {
    $DOUBLELONGquery = "SELECT dares FROM sebsal2_db.double2 ORDER BY Rand() LIMIT 1";
    $DOUBLELONGresult = mysql_query($DOUBLELONGquery);
    while ($DOUBLELONGrow = mysql_fetch_array($DOUBLELONGresult, MYSQL_NUM)) {echo "$DOUBLELONGrow[0]";}
    }

var_dump($_POST)

/*    $mode = mysql_real_escape_string($_POST['mode']);
    $player = mysql_real_escape_string($_POST['player']);
    echo $player;
    echo $mode;

    if ($player=="For him" && $mode=="Classic Collection") {
    him();
    }

    if ($player=="For her" && $mode=="Classic Collection") {
    her();
    }

    if ($player=="Double dare" && $mode=="Classic Collection") {
    double();
    }

    if ($player=="For him" && $mode=="The Long Game") {
    himlong();
    }

    if ($player=="For her" && $mode=="The Long Game") {
    herlong();
    }

    if ($player=="Double dare" && $mode=="The Long Game") {
    doublelong();
    }
*/
    ?>

Bu listeleri aşağı iki damla okumak ve kombinasyonuna bağlı olarak bir mySQL veritabanından rastgele bir alanı görüntülemek için tasarlanmıştır. Değişkenleri yineleyen kalıcı değildir, sadece bir test oldu. İki sorun:

  • Using var_dump($_POST), if you select Classic Collection it sees all the options in the right hand box as "For him" and if you select The Long Game it sees them as "For her".

  • For this reason the if statements don't work.

Cevaplar için teşekkürler!

0 Cevap