Web Analytics Made Easy -
StatCounter Help With "Submitting" Button Actions - CodingForum

Announcement

Collapse
No announcement yet.

Help With "Submitting" Button Actions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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; Sep 4, 2011, 07:11 PM.

  • #2
    Anyone know?

    Comment


    • #3
      Anybody?

      Comment


      • #4
        Anyone?

        Comment


        • #5
          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.

          Comment


          • #6
            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.

            Comment


            • #7
              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.");
              }
              
              ?>

              Comment


              • #8
                Bump, question above this post ^^

                Comment


                • #9
                  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.");
                  }
                  
                  ?>

                  Comment

                  Working...
                  X