Ruby Help with HTML Form

I have html, css, and javascript background but have never touched Ruby.
I just took over a Ruby site powered by Radiant CMS. This is what I need
(besides books and time): I need a simple html and a script to capture
the values and write them to a text file on the server. I want it to add
the inputs to the file not overwritwe them. Here is my form:

<form action="myform.php" method="post">
<p>Your N.: <input type="text" name="name" /><br />
<p>E-mail: <input type="text" name="email" /></p>
<p>Phone Number: <input type="text" name="phone" /></p>
<p>Street Address: <input type="text" name="address" /></p>

<p>Where did you enter the contest?
<select name="hear">
<option value="EDGE 102.1">EDGE 102.1</option>
<option value="NOW">NOW</option>
<option value="AM640">AM640</option>
<option value="Other">Other</option>
</select>

<p><input type="submit" value="Enter to Win"></p>
</form>

Thank you.

On Thu, Sep 22, 2011 at 9:58 PM, Mike M. [email protected] wrote:

I have html, css, and javascript background but have never touched Ruby.
I just took over a Ruby site powered by Radiant CMS. This is what I need
(besides books and time): I need a simple html and a script to capture
the values and write them to a text file on the server.

Why do you need Ruby for that when your server apparently works with
PHP already? It should be possible to modify myform.php to do what
you want, I’d say.

EDGE 102.1 NOW AM640 Other

Kind regards

robert

I was trying it with php. This was my file:

<?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $address = $_POST['address']; $hear = $_POST['hear']; $fp = fopen(”formdata.txt”, “a”); $savestring = $name . “,” . $email . “n”; fwrite($fp, $savestring); fclose($fp); echo “

Thank you!

”; ?>

When I hit submit I get a “page cannot be found”

Christopher Hunt wrote in post #1023360:
Is the myform.php in the same directory as the file calling it? It’s

not able to locate the file. Try using the relative or absolute path.

chrishuntis

No, funny enough I do not know where the file is located. I am used to
html pages in more of a tree form. This rails database is hard to grasp.
I have found some scripts and images but can not find 1 directory with
the pages. Any thoughts?

<?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $address = $_POST['address']; $hear = $_POST['hear']; $fp = fopen(”formdata.txt”, “a”); $savestring = $name . “,” . $email . “n”; fwrite($fp, $savestring); fclose($fp); echo “

Thank you!

”; ?>

When I hit submit I get a “page cannot be found”

Is the myform.php in the same directory as the file calling it? It’s
not able to locate the file. Try using the relative or absolute path.

chrishuntis