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 9 of 9
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Exclamation Help With "Submitting" Button Actions

    This is the first time I've ever tried this so please bear with me. I created this with some html code:



    What I need this to do is when the person hits submit, it sends the text in each field to a file located on the web host. I need it to look something like this:


    Here's the code I have (not sure if it will help):
    Code:
    	<div id="welcom_pan">
    	<h2><span>submit your</span>VIDEO</h2><br>
    	<p><form>
    		YouTube Link to Video <br><input type="text" name="youtubelink" size ="50"/><br /><br />
    		Do you accept the rules (below)? <br><input type="radio" name="yes" value="yes" /> Yes <input type="radio" name="no" value="no" /> No<br /><br />
    		What's happening in the video?
    	</form>
    	<form method="post">
    		<textarea name="comments" cols="40" rows="5"></textarea><br>
    	</form><br>
    	<input type="submit" value="Submit" />
    	</p> 
    	</div>
    Last edited by Feriscool; 09-05-2011 at 12:11 AM.

  • #2
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Anyone know?

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Anybody?

  • #4
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Anyone?

  • #5
    New Coder
    Join Date
    Aug 2011
    Posts
    51
    Thanks
    6
    Thanked 12 Times in 12 Posts
    It's not very clear what you're trying to do...
    but, you should name both the radio button the same name so that you can get a value from it. suppose you name both of them "accept" then if you used php, you can use something like
    PHP Code:
    if($_POST['accept'] == "yes"){
    //Run this code
    }
    else{
    Output erroregYou must accept the rules to continue.

    I also think using MySQL would be the best way to keep track of all the links and descriptions.

  • #6
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ASTP001 View Post
    It's not very clear what you're trying to do...
    but, you should name both the radio button the same name so that you can get a value from it. suppose you name both of them "accept" then if you used php, you can use something like
    PHP Code:
    if($_POST['accept'] == "yes"){
    //Run this code
    }
    else{
    Output erroregYou must accept the rules to continue.

    I also think using MySQL would be the best way to keep track of all the links and descriptions.
    I updated the thread to make it more clear.

  • #7
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Alright, so I basically got it working, but there are couple things wrong with it. How can I make each new submission create the text from the fields on the next line in the output file?

    Code:
    <?PHP
    
    $filename = "output.txt"; #Must CHMOD to 666
    $quantity = $_POST['quantity'];
    $item = $_POST['item'];
    
    $fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
    if ($fp) {
    fwrite ($fp, $quantity . ", " . $item);
    fclose ($fp);
    echo ("Thank you for submitting your video!");
    }
    else {
    echo ("There was a problem submitting your video. Try again, or report the issue.");
    }
    
    ?>

  • #8
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Bump, question above this post ^^

  • #9
    New Coder
    Join Date
    Sep 2011
    Posts
    36
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Alright, so I basically got it working, but there are couple things wrong with it. How can I make each new submission create the text from the fields on the next line in the output file?

    Code:
    <?PHP
    
    $filename = "output.txt"; #Must CHMOD to 666
    $quantity = $_POST['quantity'];
    $item = $_POST['item'];
    
    $fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
    if ($fp) {
    fwrite ($fp, $quantity . ", " . $item);
    fclose ($fp);
    echo ("Thank you for submitting your video!");
    }
    else {
    echo ("There was a problem submitting your video. Try again, or report the issue.");
    }
    
    ?>


  •  

    Posting Permissions

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