...

View Full Version : Help With "Submitting" Button Actions



Feriscool
09-04-2011, 03:01 AM
This is the first time I've ever tried this so please bear with me. I created this with some html code:

http://i.imgur.com/twTo2.png

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:
http://i.imgur.com/WFYxa.png

Here's the code I have (not sure if it will help):

<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>

Feriscool
09-04-2011, 05:54 AM
Anyone know?

Feriscool
09-04-2011, 04:16 PM
Anybody?

Feriscool
09-04-2011, 05:58 PM
Anyone?

ASTP001
09-04-2011, 08:27 PM
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

if($_POST['accept'] == "yes"){
//Run this code
}
else{
Output error, eg: You 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.

Feriscool
09-04-2011, 11:11 PM
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

if($_POST['accept'] == "yes"){
//Run this code
}
else{
Output error, eg: You 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.

Feriscool
09-05-2011, 01:52 AM
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?


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

?>

Feriscool
09-05-2011, 05:42 AM
Bump, question above this post ^^

Feriscool
09-05-2011, 04:19 PM
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?


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

?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum