Şimdi Ara

Arkadaşlar PhpBasit Anket Yardım ?

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
1 Misafir - 1 Masaüstü
5 sn
5
Cevap
0
Favori
469
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Arkadaşlar bana çok küçük bir anket lazım php ile yapacam fakat yapamadım . yardımcı olursanız sevinirim .
    örnegin sitemiz nasıl buldunuzu yapacam iyi kötü fena degil gibi cevaplar olacak veritabanına kayıt ettirecem ve index.php sayfamda göstermem gerek yardımcı olursanız sevinirim .



  • tayfun3428 T kullanıcısına yanıt
    Daha önce konu açan arkadaş senmiydin bilmiyorum ama yinede cevap vermek istiyorum.

    Öncelikle şunu bilmen gerekiyor. Buraya anket lazım bana diyerek kişilerden sizin için sıfırdan bir anket yazmasını bekleyemezsiniz.
    Bunun yeri alternatif olarak google araması sonucunda bilgiler edine bilirsiniz.

    Yapacağınız şey çok basit, kolaya kaçmaktansa bu yolu tercih etmelisin..
    Google ya Php anket sistemi yazdığın zaman binlercesi önüner serilir.




    basit ve veritabanı olmadan kullana bileceğin bir anket sistemi kodları veriyorum.


    index.php





    <?php 
    /*************************************************
    * Micro Polling System
    *
    * Version: 1.0
    * Date: 2007-04-05
    *
    * Usage:
    * Add your votings settings to polldata.txt file
    * The first line is the question and the other
    * linas are the possible answers.
    *
    ****************************************************/

    $pollQuestion = '';
    $answers = '';

    function readData(){
    global $pollQuestion,$answers;
    // Read configuration
    $rawdata = file('polldata.txt');
    // Get the question for polling
    $pollQuestion = $rawdata[0];

    // Get number of answers - The foirs row is the question
    $numberOfAnswers = sizeof($rawdata)-1;
    $count = 0;
    for ($i=1; $i <= $numberOfAnswers; $i++){
    $answerData = explode(':',$rawdata[$i]);
    // If tha actual row is not empty than add to the answers array
    if (strlen(trim($answerData[0]))>0){
    $answers[$count]['text'] = $answerData[0];
    $answers[$count]['count'] = $answerData[1];
    ++$count;
    }
    }
    }

    function writeData(){
    global $pollQuestion,$answers;
    $file = fopen('polldata.txt','w');
    fwrite($file,$pollQuestion."\r\n",strlen($pollQuestion));
    foreach ($answers as $value) {
    $row = $value['text'].':'.$value['count']."\r\n";
    fwrite($file,$row,strlen($row));
    }
    fclose($file);
    }

    readData();
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Micro Polling System</title>
    <link href="style/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="main">
    <?php if (!isset($_POST['submitBtn'])) { ?>
    <div class="caption"><?php echo $pollQuestion; ?></div>
    <div id="icon"> </div>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="poll">
    <table width="300">
    <?php
    foreach ($answers as $value) {
    echo '<tr><td><input type="radio" name="polling" value="'.$value['text'].'"/> '.$value['text'].'</td></tr>';
    }
    ?>
    <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Vote" /></td></tr>
    </table>
    </form>
    <?php
    } else {
    $count = 0;
    foreach ($answers as $value) {
    if ($value['text'] == $_POST['polling']) {
    $answers[$count]['count'] = ((int)$value['count'])+1;
    (int)$totalCount++;
    }
    ++$count;
    }

    writeData();
    ?>
    <div class="caption">Thanks for your vote!</div>
    <div id="icon"> </div>
    <div id="result">
    <table width="300">
    <?php
    foreach ($answers as $value) {
    echo '<tr><td> '.$value['text'].'</td><td>'.$value['count'].'</td></tr>';
    }
    ?>
    </table>
    </div>
    <?php } ?>
    <div id="source">Micro Polling System 1.0</div>
    </div>
    </body>




    polldata.txt


     
    What is your favorite color?
    red:0
    green:0
    blue:0
    yellow:0
    orange:0
    black:0
    white:0



    style/style.css


     
    #main {
    margin: auto;
    border: 1px solid #cccccc;
    width: 400px;
    background: #F1F3F5;
    font-family: Arial, Helvetica, sans-serif;
    font-weight:bold;
    font-size : 12px;
    }

    form {
    margin-left: 80px;
    border: 1px solid #cccccc;
    width: 300px;
    background: #E9ECEF;
    font-family: Arial, Helvetica, sans-serif;
    font-weight:normal;
    font-size : 12px;
    padding:5px;
    margin-bottom:10px;
    }

    #result {
    margin-left: 80px;
    border: 1px solid #cccccc;
    width: 300px;
    background: #E9ECEF;
    font-family: Arial, Helvetica, sans-serif;
    font-weight:normal;
    font-size : 12px;
    padding:5px;
    margin-bottom:20px;
    }

    .text {
    border: 1px solid #cccccc;
    }

    input {
    border: 0px solid #cccccc;
    }

    .values{
    font-family: verdana;
    font-weight:normal;
    font-size : 10px;
    align:top;
    vertical-align:top;
    }

    .key{
    font-family: verdana;
    font-weight:bold;
    font-size : 12px;
    padding-bottom:15px;
    }


    .caption{
    font-family: Arial, Helvetica, sans-serif;
    font-weight:bold;
    margin:10px;
    font-size : 14px;
    color:#C64934;
    }

    #icon{
    width:80px;
    height:80px;
    float:left;
    background-image:url(icon.gif);
    background-repeat: no-repeat;
    background-position:center center;
    }
    #icon2{
    width:80px;
    height:80px;
    float:left;
    background-image:url(icon2.gif);
    background-repeat: no-repeat;
    background-position:center center;
    }

    #source{
    text-align:right;
    align:right;
    padding-right:10px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight:normal;
    font-size : 10px;
    color:#CCCCCC;
    }



    ekte olan resimleride style klasorunu kaydet



    anket/

    index.php
    polldata.txt
    /style/
    ---style.css
    ---icon.gif
    ---icon2.gif





  • aksoydesign kullanıcısına yanıt
    harika ya kac konuya baktıysam hepsiyle ilgilenmişsin helal olsun
  • sycosis kullanıcısına yanıt
    Güzel Yorumunuz İçin Teşekkür ederim
  • aksoydesign kullanıcısına yanıt
    rica ederim asıl ilgin ve yardım çaban icin ben tesekkur ederim
  • Yapay Zeka’dan İlgili Konular
    Daha Fazla Göster
    
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.