PDA

View Full Version : Question about forms, PHP, and submit button


speedyalice
05-28-2008, 01:16 AM
Hi,

I hate to even ask this question, because I know there have been many posts about this. I did search and read a lot of posts about the subject, and looked in the "Help" file of Dreamweaver, but I'm still at a loss as to why my "submit" button directs to my sendresults.php page instead of the confirmation page.

I did read a post about someone who'd had the same situation, but when I went back after reading a bunch of other posts, I couldn't find it again.

Thought that maybe I needed to download a PHP application server, but a friend who knows a lot more than I do about computers said that I didn't, since my hosting company supported PHP (version 4.4.4) and that I shouldn't have to do anything additionally for it to work.

I'm very very much a greenie at web design (mostly it's volunteer stuff for an organization I'm in). I followed the tutorial on this site (which was very clear and easy to follow) and thought that I'd sent up the form and everything correctly.

Normally I'd spend more time reading about PHP and researching, but I just had eye surgery and it strains my eyes to read the computer screen (I changed the resolution so that it looks like something a kindergarner would have!! Nothing fits on my screen - very cumbersome to work with), plus I'm going out of town on Thurs and am in huge time crunch since I'm supposed to email the form before I go. :(

I'm at the point where my eyes are crossing and I'm ready to throw in the towel, and if anyone can figure out what it is I've done wrong, I'd be extremely grateful (huge understatement). I'll paste the code of the form and the code that I amended from the tutorial below. Also, the Action for the form is http://www.dressageclinics.org/sendresultshs.php and the Method is Post.

Thanks very much for any advice/help!!

***

URL of the form: http://www.dressageclinics.org/riderformhs.html

What I get when I press Submit: http://www.dressageclinics.org/sendresultshs.php
(which is probably the same as the code of the sendresultshs.php page:)


<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Seiberl Rider Info';

// Your email address. This is where the form information will be sent.
$emailadd = 'joriejay@domain.com';

// Where to redirect after form is processed.
$url = 'http://www.dressageclinics.org/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>


******
Code of form:


<form action="http://www.dressageclinics.org/sendresultshs.php" method="post" name="seiberlinfo" id="seiberlinfo">
<div align="left" class="text">
<p><span class="style7"><strong>Please fill out the following information for the July 19 - 22 Herbert Seiberl clinic and submit to me by June 1</strong>.<br>
<br>
Rider Name
<input name="textfield2" type="text" size="25">
</span><br>
<br>
<span class="style7">Horse Name</span>
<input name="textfield" type="text" size="25">
<br>
<br>
<span class="style7">Breed
<input name="textfield3" type="text" size="25">
</span></p>
<p class="style7">
<span class="style7">
<label>Horse's age
<input type="text" name="textfield4">
</label>
</span></p>
<p class="style7">
<label><span class="style7">Level you're schooling
<input name="textfield5" type="text" size="25">
</span></label>
</p>
<p class="style7">

<label><span class="style7">Number of lessons desired
<input type="text" name="textfield6">
</span></label>
</p>
<p class="style7">



<label><span class="style7">Number of lessons confirmed
<input type="text" name="textfield7">
<br>
<br>
<strong>Type of lesson(s) desired (check all that apply):</strong><br>
</span>
<span class="style7">
<input type="checkbox" name="checkbox9" value="checkbox">
riding lesson</span> </label>
<span class="style7"><br>
<label>
<input type="checkbox" name="checkbox10" value="checkbox">
longe lesson</label>
(all or part of lesson) <br>
<label>
<input type="checkbox" name="checkbox11" value="checkbox">
schooling ride (Herr Seiberl rides your horse all or part of lesson)</label>
</span></p>
<p class="text style7">


<span class="style8">
<label class="style7">
Type of stabling needed:</label>
<label> </label>
</span>
<label>
<input type="checkbox" name="checkbox2" value="checkbox">
<span class="style7">Overnight</span>
<input type="checkbox" name="checkbox" value="checkbox">
</label>
<span class="style7">Day stall<br>
<br>
</span><span class="style7">
<strong>Arrival (if overnight stabling):</strong><br>
</span><span class="style7">
<input type="checkbox" name="checkbox3" value="checkbox">
day before (first) lesson, regardless of time of lesson<br>
<input type="checkbox" name="checkbox4" value="checkbox">
day of lesson, if lesson is in late morning/afternoon
<br>
<input type="checkbox" name="checkbox5" value="checkbox">
not sure at this time.</span></p>
<p class="text">
<span class="style7">
<label>
<strong>Attending Riders' Dinner Sunday PM July 27:</strong> </label>
</span> <br>
<input type="checkbox" name="checkbox7" value="checkbox">
<span class="style7">yes
<input type="checkbox" name="checkbox6" value="checkbox">
no</span>
<input type="checkbox" name="checkbox8" value="checkbox">
<span class="style7">not sure</span><br>
<label><span class="style7">If "yes", will you be bringing a guest?</span>
<input type="checkbox" name="checkbox12" value="checkbox">
<span class="style7">yes </span>
<input type="checkbox" name="checkbox13" value="checkbox">
<span class="style7">no</span> </label>
</p>
<p class="style7">
<span class="style7">
<label><strong>Attending Longeing Workship with Herbert Seiberl on Saturday, July 26:</strong><br>
</label>
</span>
<input type="checkbox" name="checkbox72" value="checkbox">
<span class="style7">yes
<input type="checkbox" name="checkbox62" value="checkbox">
no
<input type="checkbox" name="checkbox82" value="checkbox">
<br>
(<strong><a href="longeingworkshop.html">Click here</a></strong> for more info)</span></p>
<p class="style7">
<label><span class="style7">Please write a brief summaryof any issues you are having, areas of focus you would like to work on, or any information you think would be helpful for Herr Seiberl to know:
</span>
<textarea name="textarea" cols="50" rows="10"></textarea>
</label>
</p>
<p align="center" class="style7">
<input type="submit" name="Submit" value="Submit">
</p>
<p class="text">&nbsp; </p>
<p class="style7">&nbsp;</p>
<p class="style7">&nbsp;</p>
</div>
</label>
</form>

domedia
05-28-2008, 02:16 AM
http://www.dressageclinics.org/sendresultshs.php

You need to write this code in code view, not in design view :)
Right now it's a html code displaying the code, instead of a php code.

speedyalice
05-28-2008, 03:39 AM
:shock:

Oh my gosh... :oops: That is so obvious! (well, not to me, obviously! :lol:)

Thank you so much for pointing out the obvious! It works beautifully now, of course. The email came through and now I'm going through the PHP code and changing all of the "textfield" labels to names that more accurately identify what it is that's in the field. It's so cool. :)

Thank you again so so much... I swear, I still have anesthesia from the surgery floating around in my brain. I would have spent days researching the most obscure possible reasons when it was such an obvious (can't think of a better word!) thing. I feel like the person who calls tech support complaining about the dark monitor and has to answer "no" in reply to the "is it plugged in?" query.

Really appreciate your help - good lesson learned here for me, too. <cough> Thanks again very very much!

domedia
05-28-2008, 04:06 AM
Hey I think we've all been there lol :) Hours and hours only to find out the error was so obvious..
Are you in MI as well?

speedyalice
05-29-2008, 04:33 AM
Yes, but that was sooooo stupid. Gah. How embarrassing! :eek:

And yup, I am (brrrrrrr!!). :grin: You're a Michigander? Maybe summer will come, or even Spring, one of these days...

domedia
05-29-2008, 01:06 PM
Been 8 years between Traverse City and Mackinac Bridge (moved here from Norway). Summer is almost here today.. they're promising high 69.. :cool:

speedyalice
06-25-2008, 01:46 AM
Sorry for the delayed reply! I left the morning after your post for Austria and didn't get online much... and since I've been back, it's been continual catch-up!

I missed all the storms that were hitting the Midwest while I was gone...ok, maybe *now* summer will come... you live in a beautiful part of the state, even if it does take a little longer to warm up. :)

Anyway, slightly back on topic... this forum is fabulous. I'm so crummy at HTML and can only find time to work on my website in waves (this is not one of those times, unfortunately! But in about a month...!).

Thanks again for the helping - valuable lesson learned, i.e. look first for the obvious and simple possiblity, and go from there. :)

domedia
06-25-2008, 02:53 AM
Hey speedyalice and welcome back!
Be sure to come back when you're ready to add more things to your website.

carolinawebdesign
07-03-2008, 09:00 PM
Just wanted to say that I had the same EXACT problem and this post helped me in 2 minutes as opposed to the hrs I spent trying to figure it out on my own!

Thank you, thank you.