> I am newbie in PHP. I am just learning the PHP
>through tutorials and this mailing list. I have very
>first goal of doing one project "Design web-based
>survey" using PHP and MySQL. I would appreciate if
>anybody give me some links that help to develope such
>skills. 

Search the code archives linked from http://php.net/links.php

You will doubtless find a *LOT* of web-based Survey packages in varying
stages of complexity and completion within them.

Here, however, is yet another free one to get you started:

<HTML><BODY>
  <?php
    require 'connect.inc';
    # This file is in your home dir and has in it:
    # <?php $connection = mysql_connect('localhost', 'USERNAME',
'PASSWORD');?>
    # Change your include_path in .htaccess or php.ini PHP can find that
file.
    
    $answer = substr($answer, 0, 1);
    $answer = strtolower($answer);
    if ($answer != 'y'){
      echo "Wrong answer.<BR>\n";
    }
    $query = "insert into answers (answer) value('$answer')";
    $insert = mysql_query($query, $connection) or error_log(mysql_error());
    if (!$insert){
       "Unable to record your answer.  Ask the site administrator to read
his Apache error_log.<BR>\n";
    }
    else{
      echo "Thanks for filling out our Survey!<BR>\n";
    }
    if (!isset($answer) || $answer != 'y'){
      ?>
        <FORM ACTION=<?=$PHP_SELF?> METHOD=POST>
          Should I have searched the archives and code repositories before
posting to PHP-General?<BR>
          <INPUT TYPE=RADIO NAME=answer VALUE=y CHECKED> Yes<BR>
          <INPUT TYPE=RADIO NAME=answer VALUE=n> No<BR>
          <INPUT TYPE=SUBMIT>
        </FORM>
      <?php
    }
  ?>
</BODY></HTML>

PS  The logical error some readers will think they have spotted on lines 10
and 21 is not, in fact, a bug at all. :-)

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to