Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP form submit help

    Hello ive just set up a radio and im trying to, make a request script.

    What im trying to do it have a form which has like

    Name:

    Email:

    Request:

    Then you click submit and it writes the infomation to a txt file and also add the date and then have the option to either make a request or shoutout, so theres a scroll menu which says request and shoutout. If any one has the code or a tutorial.

    Ill really thank you.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,497
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I hate to just give a Google answer, but there are so many ways to do this,
    and more decisions you need to make (like captcha?), validation issues, etc.

    http://www.google.com/search?hl=en&q...earch&aq=f&oq=

    Plus, not many of us have time to write scripts for people. If you write your own
    and ask questions about it, you might get some good help.

  • #3
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    if youd like i could make your request form using my contact form at http://www.owt200x.us/contactform I could also integrate it into your form if you already have the html page made for it.

    If you want me to make it let me know what fields.

    I dont charge, but i do ask for a donation to build a homeless shelter.

    Thanks,
    Barry

  • #4
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok well ive made one well got some parts off google.

    PHP Code:
    <?php
    mysql_connect
    ("host","username","password");
    //Change the above line
    mysql_select_db("database");
    //Change the above line
    $reg "yes";
    $ip $_SERVER['REMOTE_ADDR'];
    ?>
    <html>
    <head>
    <title>Request a song</title>
    </head>
    <body>
    <?php
    echo "Your ip is: ".$ip."<br />";
    if (isset(
    $_POST['submit'])) {
    if (empty(
    $_POST['song'])) {
    echo 
    "Sorry, you haven't supplied the song title!<br />";
    $reg "no";
    }
    if (empty(
    $_POST['artist'])) {
    echo 
    "Sorry, you haven't supplied the artists name!<br />";
    $reg "no";
    }
    if (empty(
    $_POST['name'])) {
    echo 
    "Sorry, you haven't supplied your name<br />";
    $reg "no";
    }

      
    $sql "SELECT COUNT(*) FROM request_song WHERE ip='{$ip}'";
      
    $result mysql_query($sql);
      if (
    mysql_result($result0) > 0) {
    echo 
    "Sorry, your ip has already wished for one song, you can not wish for <br />another until the DJ's have seen your request!<br />";
    $reg "no";
    }
    if (
    $reg == "yes") {
        
    $sql "INSERT INTO request_song(song, artist, name, ip)
                VALUES('{$_POST['song']}', '{$_POST['artist']}', '{$_POST['name']}', '{$ip}')"
    ;
        
    mysql_query($sql);
    }
    }
    ?>
    <form action="request.php" method="POST">
    <table>
    PHP Code:
    <?php
    mysql_connect
    ("host","username","password");
    //Change the above line
    mysql_select_db("database");
    //Change the above line
    ?>
    <html>
    <head>
    <title>Requested songs</title>
    </head>
    <body>
    <table width="600" border="1">
    <tr><td>ID</td><td>Song</td><td>Artist</td><td>Requested by</td><td>IP</td><td>Delete</td></tr>
    <?php
    if ($_GET['del']) {
    $delete $_GET['del'];
    $delque "DELETE FROM request_song WHERE id='{$delete}'";
    mysql_query($delque);
    }
    $query "SELECT * FROM request_song ORDER BY id ASC";
    $result mysql_query($query);
    while (
    $row mysql_fetch_assoc($result)) {
    $id $row['id'];
    $song $row['song'];
    $artist $row['artist'];
    $name $row['name'];
    $ip $row['ip'];
    echo 
    "<tr><td>".$id."</td><td>".$song."</td><td>".$artist."</td><td>".$name."</td><td>".$ip."</td><td><a href='?del=".$id."'>Delete</a></td></tr>";
    }
    ?>
    </table>
    </body>
    </html>
    But if i wanted to add the option shoutout so they can choose either request or shout out wat would i add? Thanks

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,497
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I'm sort of ignorant about the radio thing.

    What is the difference between a "shout out" and a "request".

    Is it just a different field in the database, or does one get emailed and the other not?
    What is supposed to happen between the two?

  • #6
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well what i mean is like. The request is set out to add song name artist and user name. into the database then showes it up on the table. but i need to add where a mean comes down and u can click shoutout/request and i need to add more tables into the database but im not very good with mysql and only basic on php.

  • #7
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    ohhhh, you want a form that sends the data to a sql table. my form code only sends the form data to email.

    if you want to use mine with custom fields, let me know.


  •  

    Posting Permissions

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