Page 1 of 2

need help with FORMS coding.

Posted: Wed Jan 28, 2004 9:13 am
by flyers2thecup
Hey all. This is my first time on this forum and first post. I am VERY new to PHP and don't claim to know much. I'm trying to learn.

I run a couple of fantasy leagues and it became apparent that PHP would be a great addition to my sites. Since i'm still very new at this, i figured i'd start small. So i'm starting with a FORM SUBMISSION script.

I've been looking around at the scripts online and trying to adjust to my personal likings. I did find one that seemed pretty straight forward. I figured out the fields that i could change to suit me.

I tried plugging the script into a template page for my site. it's at http://www.trffl.com/lineup.shtml

Two things:

1. I can't figure out for the life of me, why the SUBMIT LINEUP button is in the middle of the form and cutoff. I'd obviously like it to be at the bottom inside the table.

2. How do I get the button to actually do something?

As I said, I downloaded this script and it came with the following files:

advanced.log
advanced-email.txt
advanced-email-autorespond1.txt
advanced-email-autorespond2.txt
advanced-error.html
advanced-logfile.txt
advanced-thank-you.html
form.cfg
index.html
style.css

I took the code from the index.html file. I will upload the style.css file. I've edited the txt files to put in the info I want. I do not know what to do with the FORM.CFG file.

Here is the code for the page:

Code: Select all

<!--#include virtual="/test/header1.html" -->

<!--#include virtual="/test/header2.html" -->

<!--#include virtual="/test/leftnav.html" -->



    <td width="10" valign="top" align="right"></td>

    <td vAlign=top  bgcolor="#ffffff">

    



      <table align="left" width="100%" cellSpacing="0" cellPadding="2" border="0" bordercolor="red"> 
        <tr>
          <td>

<!--Heading Start-->

            <table width="500" align="center" border="3" bordercolor="#425A72" cellpadding="5" cellspacing="0" bgcolor="#425A72">

              <tr>

                <td align=center><font face="verdana" size="5" color="ffffff"><b>Submit Lineup</b></a></td>

              </tr>

            </table>



<!--Heading End-->

<br>

<!--2003-04 Start-->



            <table align="center" width="500" cellspacing="0" cellpadding="2" border="2" bordercolor="#425A72"> 
              <tr>
                <td align="center">
            
                  <table width="100%" border="0" cellspacing="2" cellpadding="2">
                    <tr>
                      <td><a NAME="lineup"></a>                        
                            

                              <td class="bhead"><b>Attention:</b> Please use your valid Pittsburgh Fantasy Baseball League email address. This script will send the results of the processing to the entered email.</td>

                                    <form name="Simple" method="post" action="/cgi-bin/formprocessorpro.pl">
                                      <p align="center"> <font size="2"> 
                                      <input type="hidden" name="base_path" value="../sample-forms/advanced-form">
                                    </font></p>



                     

                                    <table border="0" cellspacing="0" cellpadding="0" align="left">
                                      <tr> 
                                        <td align="right" class="maintext">&nbsp;</td>
                                        <td><font color="#FF0000">All fields are required</font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Name : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="r_Name" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Team Name : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="Team-Name" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Week # : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="Week" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Opponent : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="Opponent" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Contact eMail : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="re_eMail" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">&nbsp;</td>
                                        <td>&nbsp;</td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">&nbsp;</td>
                                        <td> <font color="#FF0000">Please include Player Name and Team.</font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">C : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="C" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">1B : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="1B" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">2B : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="2B" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SS : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SS" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">3B : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="3B" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF1" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF3" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF4" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">UT : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="UT" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP1" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP3" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP4" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP5" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">RP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="RP1" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">RP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="RP2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                    </table>

                   

<div align="center"> 
  <p>
   <font size="2"> <br>
    <input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::.." class="buttons">
   </font>
  </p>
</div>
</form>

                      </td>
                    </tr>
                  </table>

                </td>
              </tr>
            </table>


<!--2002-03 End-->

<br>

<!--NFL Weekly Schedule End-->

          </td>
        </tr>
      </table>


<!--keep this closing--> 

    </td>
  </tr>

</table>

<!--keep this closing-->

<!--#include virtual="/test/footer.html" -->


Sorry for the long post. :oops:

Am I over my head? Is this something that can easily addressed by one of you guys?

Thanks for any guideance!!!

Posted: Wed Jan 28, 2004 10:07 am
by ol4pr0
To fix youre button problem this should work.

Youre problem was within youre table sizes... i wouldnt use the 100% tablesizes if they can be avoided.

Code: Select all

echo <<<YOURETABLE

<!--2003-04 Start-->


<table align="center" width="500" cellspacing="0" cellpadding="2" border="2" bordercolor="#425A72"> 
              <tr>
                <td align="center" width="500">
            
                  <table width="500" border="0" cellspacing="2" cellpadding="2">
                    <tr>
                      <td><a NAME="lineup"></a>                        
                            

                              <td class="bhead"><b>Attention:</b> Please use your valid Pittsburgh Fantasy Baseball League email address. This script will send the results of the processing to the entered email.</td>

                                    <form name="Simple" method="post" action="/cgi-bin/formprocessorpro.pl">
                                      <p align="center"> <font size="2"> 
                                        <input type="hidden" name="base_path" value="../forms">
                                      </font></p>



                     

                                    <table border="0" cellspacing="0" cellpadding="0" align="left">
                                      <tr> 
                                        <td align="right" class="maintext">&nbsp;</td>
                                        <td><font color="#FF0000">All fields are required</font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Name : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="r_Name" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Team Name : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="Team-Name" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Week # : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="Week" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Opponent : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="Opponent" maxlength="64" size="45" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">Contact eMail : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="re_eMail" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">&nbsp;</td>
                                        <td>&nbsp;</td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">&nbsp;</td>
                                        <td> <font color="#FF0000">Please include Player Name and Team.</font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">C : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="C" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">1B : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="1B" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">2B : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="2B" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SS : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SS" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">3B : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="3B" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF1" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF3" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">OF : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="OF4" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">UT : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="UT" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP1" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP3" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP4" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">SP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="SP5" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">RP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="RP1" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </font></td>
                                      </tr>
                                      <tr> 
                                        <td align="right" class="maintext">RP : </td>
                                        <td><font size="2"> 
                                            <input type="text" name="RP2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
    <input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::.." class="buttons"></font></td>
                                      </tr>
                                    </table>

                   

<div align="center"> 
  <p>
   <font size="2"> <br>
    &nbsp;</font></p>
</div>
</form>

                      </td>
                    </tr>
                  </table>

                </td>
              </tr>
            </table>


<!--2002-03 End-->

YOURETABLE;

thanks...but

Posted: Wed Jan 28, 2004 11:03 am
by flyers2thecup
that did in fact move the button to the bottom. but now the last RP is vertically aligned correctly.

should i put the button in it's own table?

Posted: Wed Jan 28, 2004 11:19 am
by ol4pr0

Code: Select all

<input type="text" name="RP2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'> 
    <input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::.." class="buttons"></font></td>

Code: Select all

Sorry made a mistake its because i didnt add a <td> tag 

as you can see it doesnt have a brake between

Code: Select all

rgb(50,50,50);'> ( no break here )
    <input type="submit" name
So it will mess it up a bit.

however by doing this you should be fine

Code: Select all

<input type="text" name="RP2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'> </td></tr> <-- closing it
<td> // <--------- there you go.
    <input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::.." class="buttons"></font></td>

excellent.

Posted: Wed Jan 28, 2004 11:58 am
by flyers2thecup
That worked.

1. why can't i CENTER the button?
2. I want a space between the bottom RP and the BUTTON. How?

Code: Select all

<tr> 
                                        <td align="right" class="maintext">RP : </td> 
                                        <td><font size="2"> 
                                            <input type="text" name="RP2" size="45" maxlength="64" style='border: 1 outset rgb(50,50,50);'>
                                        </td>
                                      </tr>
                                      <td>&nbsp;</td><<===why does this cause the whole thing to center??  i was trying to put a space
                                        <td> 
                                            <input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::.."></font>
                                        </td> 
                                      </tr> 
                                    </table>

Posted: Wed Jan 28, 2004 12:14 pm
by ol4pr0
Well i havent looked @ the compleet code.. but it normally cuases to align
left or right / center because you have used the alignment before and didnt close some <td align> </td> That might be one reason.

i suggest you look up some tutorials on how to make and create tables especially with all the td tr align / valign tags.

They are simple to learn but they can mess up youre form easely when you do not close some opening tags.
you can easely redesign youre table as long as you just keep the action the same if you want to use that perl script.

Code: Select all

<form name="Simple" method="post" action="/cgi-bin/formprocessorpro.pl">

html

Posted: Wed Jan 28, 2004 1:05 pm
by flyers2thecup
i appreciate all the help with the "submit button".

as far as HTML goes, i'm confident that i closed all the tags. and i know that they all should be closed, so i don't know that a tutorial will "fix" the problem. i just think it's a matter of figuring out the right coding.

but again, i appreciate the help you've given me!! i'm almost there!

THANKS!!!

Posted: Wed Jan 28, 2004 1:07 pm
by Derfel Cadarn
Centering a button...rather basic: try

Code: Select all

<td align="center"><br> 
                                            <input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::..">
                                        </td>
That should bring an extra space into things too.

oops...forgot

Posted: Wed Jan 28, 2004 1:08 pm
by flyers2thecup

you can easely redesign youre table as long as you just keep the action the same if you want to use that perl script.
Code:

<form name="Simple" method="post" action="/cgi-bin/formprocessorpro.pl">

ol4pr0,

where does "formprocessorpro.pl" come from? when i downloaded the script, this file wasn't included. i check the cgi-bin on my server and it's not there either.

Posted: Wed Jan 28, 2004 1:13 pm
by ol4pr0
If you would closely add youre code you would notice that it has 2 blocks below.

youre submit button locates itself now in the right box. and is aligned=left of that box.

Code: Select all

In my editor in line 381 youll find this .

                                        &lt;td&gt;&amp;nbsp;&lt;p&gt;&amp;nbsp;&lt;/td&gt;
                                        &lt;td&gt; 
                                            &lt;input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::.."&gt;&lt;/font&gt;
                                        &lt;/td&gt;
to make it somewhat more clear

Code: Select all

<td>&nbsp;<p>&nbsp;</td>
                                        <td> 
                                            <input type="submit" name="Submit" value="..:: SUBMIT LINEUP ::.."></font>
                                        </td>
hope that will asnwer youre question. Above also include the extra space you wanted between last field and button

Posted: Wed Jan 28, 2004 1:13 pm
by Derfel Cadarn
What I do NOT understand is that you say you want to learn PHP and start with a Formmailer (which in itself I think is a good idea) and then you download & install a Perl-formmailer!!

Code: Select all

<form name="Simple" method="post" action="/cgi-bin/formprocessorpro.pl">
This runs a Perl-script, not a PHP-script (then it would end with .php).
To put it rude, I could say "RTFM", but I prefer to put it friendly: read a bit more about PHP in this introduction on php.net!

haha!

Posted: Wed Jan 28, 2004 1:14 pm
by flyers2thecup
derfel cardan,

i would have sworn on my PC that i tried that. i agree that was the obvious answer. but apparently i did something wrong. it just worked.

oh well, i'm not too proud to admit it! i'm just happy to see it in the middle. HOORAY! :D :D

i see said the blind man.....

Posted: Wed Jan 28, 2004 1:19 pm
by flyers2thecup
:lol:

The site i downloaded this from had it in a PHP folder under FORM MAILERS. THEY TRICKED ME!


so, would you suggest i scrap this? or should i just try and deal with the PERL?

Posted: Wed Jan 28, 2004 1:27 pm
by Derfel Cadarn
Well, when you're just starting learning to programm, PHP might be easier than Perl. I suggest: throw away that perl-formmailer and get one in PHP. Have you tried googling: [google]php formmailer[/google]?

will do

Posted: Wed Jan 28, 2004 1:49 pm
by flyers2thecup
I will scrap this formmailer. I did find another one. and all the files included have .PHP extension. I will give it a shot when I get home and i'll post the outcome.

Thanks guys!!!!