www.webdeveloper.com
Results 1 to 8 of 8

Thread: Help with "automatic forms" or something...

Hybrid View

  1. #1
    Join Date
    Mar 2013
    Posts
    4

    Question Help with "automatic forms" or something...

    Hello! I am a 17 year old student, working on some IT-project at school. I'm not very experienced, though IT is my hobby... I said that, since I want as simple replies as possible, not like hardcore high leveled developers replies!
    So, I'm 100% new to this forum, but wanted to join, simply because I'll need much help now, which I can't really get from my teacher.

    Now, to the real topic:
    I'm currently making a webiste (in norwegian) where one can vote to what one think is the best product (for example...)
    As I don't have the whole IT vocabulary, I'm gonna have to explain what I mean in a.... N00bish way.
    Heres the complete idea: I want to make the voting-part as automatic as possible. I want the user/client/whatever to just click on a picture to vote. Then the vote will be magically registered (with the clients IP as primary key???), and the client will be redirected to the main page/or the rusults page.

    This is my idea, but I really need help to make it work. None of my books have anything near this to help me, nor do I know what to search for in google.
    Sorry for a long and depressive post, but I hope some people can take the time and try understanding what I meant, and then lead me to the right direction
    -Amund.

  2. #2
    Join Date
    Mar 2013
    Posts
    4
    Bump?
    I really need help
    And of course if you guys know of a much easier way, please tell me that too

  3. #3
    Join Date
    Mar 2013
    Location
    Iasi, Romania
    Posts
    53
    Can you use javascript or only php?

  4. #4
    Join Date
    Mar 2013
    Location
    Iasi, Romania
    Posts
    53
    This is how you can do it only with php.
    This is the HTML file
    PHP Code:
    <?
    //connect and select the db, get the info you need
    if([ip_check])//check if the ip is already in your DB. if so
    header('Location:[results_page]');
    ?>
    [HTML]
    <html>
    <a href="[your_script].php?id=[unique_value_integer]"><img src="[path_to_your_image]"/></a>
    <a href="[your_script].php?id=[unique_value_integer]"><img src="[path_to_your_image]"/></a>
    //you can add more if you need
    </html>
    [/HTML]
    This is the php script:
    PHP Code:
    <?php
    //connect and select the db
    $id=intval($_REQUEST['id']);
    //insert the data in your db where the id=$id
    header('Location:[results_page]');
    ?>
    This way you don't have to use radio buttons and the user will see the poll only once, if he's ip doesn't change

  5. #5
    Join Date
    Mar 2013
    Location
    Iasi, Romania
    Posts
    53
    Quote Originally Posted by ssdog View Post
    PHP Code:
    <?php
    //connect and select the db
    $id=intval($_REQUEST['id']);
    //insert the data in your db where the id=$id
    header('Location:[results_page]');
    ?>
    insert the data in your db, but not where id=$id, id will be the indicator of your poll category.

  6. #6
    Join Date
    Mar 2013
    Posts
    4
    Or actually, I DID understand those things.... hehe
    I'll just have to try it out (after the weekend.)

  7. #7
    Join Date
    Mar 2013
    Posts
    4
    Nice! Thank you very much, ssdog!
    Yes, I'm supposed to stick to php, as we don't have anything about javascripts at school.
    I will have to study your replies a bit though, as I atm don't really understand much of it. But I'm pretty sure I will get it soon, and thank you so much for your help!
    I'll reply to this thread again some time, if there will be more I need help with. Hope you get a notification then? :P

  8. #8
    Join Date
    Mar 2013
    Location
    Iasi, Romania
    Posts
    53
    well...good luck and enjoy coding

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles