Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-15-2010, 04:27 AM   PM User | #1
slade powers
New Coder

 
Join Date: Dec 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
slade powers is an unknown quantity at this point
need help creating simpl php comment page

hello all: hope i am in the right place.
i am looking to build a comment type page on
our church website. i suppose it would be
similar to the one the comment section
on you tube. in all actuality it is a
testimony page where they may post
what is good in their lives.
i have some code written
but i'm not very good at it...just learning.
i have run across some very elaborate free
comment editors but they are too much for
our needs.
basically, all we need is a very simple script
that will reflect whatever the user inputs
into the text area of the form allowing us to
edit as needed.

here is our html code:

<form id="testify" name="testify" method="post" action="testify.php">
<h4>
<textarea name="testimony" id="testimony" cols="45" rows="5"></textarea>
</h4>
</form>
<p>
<input type="submit" name="button2" id="button2" value="Testify Now" />
</p>
</div>
</div>

from here we get kinda stuck. We appreciate any help that may be available.
Thank You.
slade powers is offline   Reply With Quote
Old 12-15-2010, 05:06 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Divide the task into chunks.

Chunk 1: User enters data into an HTML form and submits.

Chunk 2: Data is saved into a file or database table.

Chunk 3: Data is displayed.

Take it one chunk at a time.

Now a kind note: You are going to be spammed into the ground by spammers if you do not have some kind of approval mechanism in place. If you do nothing but kick back to the page whatever is entered in the form, you'll have hundreds of Viagra and ***** enlargement posts overnight. Just a friendly warning.
__________________
Fumigator is offline   Reply With Quote
Old 12-15-2010, 05:51 AM   PM User | #3
slade powers
New Coder

 
Join Date: Dec 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
slade powers is an unknown quantity at this point
here we have attempted to put php script in an html doc so that it will
display in the text area hopefully after the text has been entered by the user:

<form id="testify" name="testify" method="post" action="testify.php">
<h4>
<textarea name="testify" id="testify" cols="45" rows="5"></textarea>
</h4>
</form>
<p>
<input type="submit" name="button2" id="button2" value="Testify Now" />
</p>
</div>
</div>


testify.php:

<html>
<body>

Welcome
PHP Code:
<?php echo $_POST["testify"]; ?>
!<br />


</body>
</html>
slade powers is offline   Reply With Quote
Old 12-15-2010, 03:40 PM   PM User | #4
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
How did that work out for ya?

You want to be careful to keep your HTML valid. The "id" attribute should be unique throughout your page and you have two elements with an id of "testify".
__________________
Fumigator is offline   Reply With Quote
Old 12-17-2010, 05:59 PM   PM User | #5
slade powers
New Coder

 
Join Date: Dec 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
slade powers is an unknown quantity at this point
i so apologize for not responding sooner. my kid got sick and it's been a mess. thank
you for your patience.
I've changed the id to "testimony", so as to make sure the id is unique throughout the page. again i apologize and hope you will still help us.



Code:
<form id="testimony" name="testify" method="post" action="testify.php">
<h4>
<textarea name="testify" id="testify" cols="45" rows="5"></textarea>
</h4>
</form>
<p>
<input type="submit" name="button2" id="button2" value="Testify Now" />
</p>
</div>
</div>
<html>
<body>

PHP Code:
<?php echo $_POST["testify"]; ?>
!<br />


</body>
</html>

its good that i learned to keep the id name attribute separate from the other names in the form. thanks.
slade powers is offline   Reply With Quote
Old 12-17-2010, 06:23 PM   PM User | #6
adarshakb
Regular Coder

 
adarshakb's Avatar
 
Join Date: Jun 2009
Location: Silicon valley of india
Posts: 247
Thanks: 11
Thanked 1 Time in 1 Post
adarshakb has a little shameless behaviour in the past
You need to establish an sql connection if you want to store in database

PHP Code:
function GET_CONNECTION($host,$account,$password,$db)
    {
                       
$err=NULL;        
                       
$c = @ new mysqli($host,$account,$password,$db); 
        if (
mysqli_connect_errno() != 0) { // // get the text of the error message from MySQLi // 
        
$err mysqli_connect_error();$err.= "\nConection to database failed!<br />"; }
        if(
$err!=NULL)
        throw new 
Exception($err);        
        
        return 
$c;
    } 
Then you may need to escape string with php to put it in database

PHP Code:
mysql_escape_string($string); 
Also you need a database table to store the testimonials
__________________
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

Albert Einstein
-----------------------------------------------------
My Blog songs

Last edited by adarshakb; 12-17-2010 at 06:27 PM..
adarshakb is offline   Reply With Quote
Old 12-19-2010, 08:23 PM   PM User | #7
slade powers
New Coder

 
Join Date: Dec 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
slade powers is an unknown quantity at this point
thank you...i'm beginning to work on it now. i'm currently setting up the database in myphpadmin. back very soon.
slade powers is offline   Reply With Quote
Old 12-19-2010, 08:49 PM   PM User | #8
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Is someone going to administer the comments before they are posted?
I hate to think this would happen, but you're going to end-up with comments
your church will not want on their website ... and who is going to be the judge
of what comments are accepted and which one's are not?
I personally think it's a bad idea.

The only reason I would say to go ahead and do this project, would be so you
could learn more about PHP and MySQL. The experience will be more beneficial
than the result.
mlseim is offline   Reply With Quote
Old 12-22-2010, 02:21 AM   PM User | #9
slade powers
New Coder

 
Join Date: Dec 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
slade powers is an unknown quantity at this point
I apologize but continue to need help...

i regret to inform that the church has decided to hire someone to do the backend. i am disappointed that i was not able to see this through to completion. However, i am working on a personal site and need php/myphpadmin assistance in accessing form data so i can use it.

here is the html created in cs4:

Code:
  <legend>Parents Contact Information</legend>
      </h3>
      <form id="form1" name="form1" method="POST" action="babiesnmovies.php">
        <p>
          <label for="babiesnmovies.com/register">Your First Name</label>
          <input type="text" name="yourfirstname" id="babiesnmovies.com/register" /> 
          <label for="babiesnmovies.com/registered"><br />
          Your Last Name</label>
          <input type="text" name="yourlastname" id="babiesnmovies.com/registered" />
        </p>
        <p>
          <label for="babiesnmovies.com/yourname">Your Phone Number</label>
          <input type="text" name="yourphonenumber" id="babiesnmovies.com/yourname" />
          <label for="babiesnmovies.com/email"><br />
          Your E-mail</label>
          <input type="text" name="youremail" id="babiesnmovies.com/email" />
          </p>
        </p>
        <p>&nbsp;</p>
    <h3>
      <legend>Baby's Vitals</legend>
    </h3>
      <p>
        <label for="babiesnmovies.com/baby'slast">Baby's First Name</label>
        <input type="text" name="babysfirstname" id="babiesnmovies.com/baby'sfirst" />
        <label for="babiesnmovies.com/babies">Baby's Middle Name</label>
        <input type="text" name="babysmiddlename" id="babiesnmovies.com/babies" />
      </p>
      <p>
        <label for="babyslastname">Baby's Last Name</label>
        <input type="text" name="babyslastname" id="babyslastname" />
      </p>
      <p>
        <label for="babiesnmovies.com/babybday">Baby's Birthdate</label>
        <input type="text" name="babysbirthdate" id="babiesnmovies.com/babybday" />
        <label for="babiesnmovies.com/babyage">Baby's Age</label>
        <input type="text" name="babysage" id="babiesnmovies.com/babyage" />
        
      </p>
      <p>
        <label for="babiesnmovies.com/baby">Baby's Height</label>
        <input type="text" name="babysheight" id="babiesnmovies.com/baby" />
        <label for="babiesnmovies.com/babyweight">Baby's Weight</label>
        <input type="text" name="babysweight" id="babiesnmovies.com/babyweight" />
      </p>
      <p>
        <label for="babiesnmovies.com/babyeyes">Baby's Eye Color</label>
        <input type="text" name="babyseyecolor" id="babiesnmovies.com/babyeyes" />
        <label for="babiesnmovies.com/babyhair">Baby's Hair Color</label>
        <input type="text" name="babyshaircolor" id="babiesnmovies.com/babyhair" />
      </p>
      <p>
        <label for="babiesnmovies.com/babyrace">Baby's Ethnicity</label>
        <input type="text" name="babysethnicity" id="babiesnmovies.com/babyrace" />
      </p>
      <p><input name="formsubmit" type="submit" value="Submit" />
    </form>

PHP Code:
$yourfirstname $_POST['YourFirstName'];
$yourlastname $_POST['YourLastName'];
$yourphonenumber $_POST['YourPhoneNumber'];
$youremailaddress $_POST['YourE-mailAddress'];
$babysfirstname $_POST['BabysFirstName'];
$babysmiddlename $_POST['BabysMiddleName'];
$babyslastname $_POST['BabysLastName'];
$babysbirthdate $_POST['BabysBirthdate'];
$babysage $_POST['BabysAge'];
$babysheight $_POST['BabysHeight'];
$babysweight $_POST['BabysWeight'];
$babyseyecolor $_POST['BabysEyeColor'];
$babyshaircolor $_POST['BabysHairColor'];
$babysethicity $_POST['Babys Ethnicity'];


mysql_select_db("xxx"$con);
         
$sql="INSERT INTO register (Your First Name, Your Last Name, Your Phone Number, Your E-mail Address, Baby's First Name, Baby's Middle Name,
Baby's Last Name, Baby's Birthdate, Baby's Age, Baby's Height, Baby's Weight, Baby's Eye Color, Baby's Hair Color, Baby's Ethnicity) values ('$yourfirstname',
'$yourlastname', '$yourphonenumber', '$youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname',
'$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')"
;

 
mysql_query($sql$con) or die ("<br>Query string: $sql<br>Produced error: " mysql_error() . '<br>');

?> 
when i hit the submit button it appears that no data is sent to the server. i really would like as much help as possible. i want to learn this even if the church has taken a different path. i want this.

Thanks so very very much.
Attached Thumbnails
Click image for larger version

Name:	myphpadmin screen.jpg
Views:	20
Size:	47.5 KB
ID:	9213  
slade powers is offline   Reply With Quote
Old 12-22-2010, 02:34 AM   PM User | #10
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Oh, I know why ....

your form variable names are all small case,
but on the processing script, you have mixed case variable names.

<input type="text" name="yourfirstname" id="babiesnmovies.com/register" />
$yourfirstname = $_POST['YourFirstName'];

... and all of them are like that.


.

Last edited by mlseim; 12-22-2010 at 02:39 AM..
mlseim is offline   Reply With Quote
Old 12-22-2010, 11:57 AM   PM User | #11
slade powers
New Coder

 
Join Date: Dec 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
slade powers is an unknown quantity at this point
i'm really lost now. any advice? thank you.

thanks so much for the prompt response. it's so good to receive a little help from real coders.

i've implemented all the suggested changes and the script and code are as follows:
Code:
        <legend>Parents Contact Information</legend>
      </h3>
      <form id="form1" name="form1" method="POST" action="Connections/babiesnmovies.php">
        <p>
          <label for="babiesnmovies.com/register">Your First Name</label>
          <input type="text" name="YourFirstName" id="babiesnmovies.com/register" /> 
          <label for="babiesnmovies.com/registered"><br />
          Your Last Name</label>
          <input type="text" name="YourLastName" id="babiesnmovies.com/registered" />
        </p>
        <p>
          <label for="babiesnmovies.com/yourname">Your Phone Number</label>
          <input type="text" name="YourPhoneNumber" id="babiesnmovies.com/yourname" />
          <label for="babiesnmovies.com/email"><br />
          Your E-mail</label>
          <input type="text" name="YourE-mailAddress" id="babiesnmovies.com/email" />
          </p>
        </p>
        <p>&nbsp;</p>
    <h3>
      <legend>Baby's Vitals</legend>
    </h3>
      <p>
        <label for="babiesnmovies.com/baby'slast">Baby's First Name</label>
        <input type="text" name="BabysFirstName" id="babiesnmovies.com/baby'sfirst" />
        <label for="babiesnmovies.com/babies">Baby's Middle Name</label>
        <input type="text" name="BabysMiddleName" id="babiesnmovies.com/babies" />
      </p>
      <p>
        <label for="babyslastname">Baby's Last Name</label>
        <input type="text" name="BabysLastName" id="babyslastname" />
      </p>
      <p>
        <label for="babiesnmovies.com/babybday">Baby's Birthdate</label>
        <input type="text" name="BabysBirthdate" id="babiesnmovies.com/babybday" />
        <label for="babiesnmovies.com/babyage">Baby's Age</label>
        <input type="text" name="BabysAge" id="babiesnmovies.com/babyage" />
        
      </p>
      <p>
        <label for="babiesnmovies.com/baby">Baby's Height</label>
        <input type="text" name="BabysHeight" id="babiesnmovies.com/baby" />
        <label for="babiesnmovies.com/babyweight">Baby's Weight</label>
        <input type="text" name="BabysWeight" id="babiesnmovies.com/babyweight" />
      </p>
      <p>
        <label for="babiesnmovies.com/babyeyes">Baby's Eye Color</label>
        <input type="text" name="BabysEyeColor" id="babiesnmovies.com/babyeyes" />
        <label for="babiesnmovies.com/babyhair">Baby's Hair Color</label>
        <input type="text" name="BabysHairColor" id="babiesnmovies.com/babyhair" />
      </p>
      <p>
        <label for="babiesnmovies.com/babyrace">Baby's Ethnicity</label>
        <input type="text" name="BabysEthnicity" id="babiesnmovies.com/babyrace" />
      </p>
      <p><input name="formsubmit" type="submit" value="Submit" />
    </form>

PHP Code:
$yourfirstname $_POST['YourFirstName'];
$yourlastname $_POST['YourLastName'];
$yourphonenumber $_POST['YourPhoneNumber'];
$youremailaddress $_POST['YourE-mailAddress'];
$babysfirstname $_POST['BabysFirstName'];
$babysmiddlename $_POST['BabysMiddleName'];
$babyslastname $_POST['BabysLastName'];
$babysbirthdate $_POST['BabysBirthdate'];
$babysage $_POST['BabysAge'];
$babysheight $_POST['BabysHeight'];
$babysweight $_POST['BabysWeight'];
$babyseyecolor $_POST['BabysEyeColor'];
$babyshaircolor $_POST['BabysHairColor'];
$babysethicity $_POST['BabysEthnicity'];


mysql_select_db("db337879506"$con);
          
$sql="INSERT INTO register (Your First Name, Your Last Name, Your Phone Number, Your E-mail Address, Baby's First Name, Baby's Middle Name,
Baby's Last Name, Baby's Birthdate, Baby's Age, Baby's Height, Baby's Weight, Baby's Eye Color, Baby's Hair Color, Baby's Ethnicity) values ('$yourfirstname',
'$yourlastname', '$yourphonenumber', '$youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname',
'$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')"
;
          

 
mysql_query($sql$con) or die ("<br>Query string: $sql<br>Produced error: " mysql_error() . '<br>');

?> 
i've also removed the
PHP Code:
header"Location: http://www.babiesnmovies.com/ThankU4Registering.html" ); 
from the script to see what happens when the form is submitted. it appears as if the header masked the exceptions...maybe because it was the code encountered first. anyway, this is the output when i submitted the form with random info:

Query string: INSERT INTO register (Your First Name, Your Last Name, Your Phone Number, Your E-mail Address, Baby's First Name, Baby's Middle Name, Baby's Last Name, Baby's Birthdate, Baby's Age, Baby's Height, Baby's Weight, Baby's Eye Color, Baby's Hair Color, Baby's Ethnicity) values ('SF', 'SDF', '', '', 'SDGF', 'SDF', 'SDF', 'SDF', '', '', '', 'SDF', 'SDF', '')
Produced error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'First Name, Your Last Name, Your Phone Number, Your E-mail Address, Baby's First' at line 1

i'm really lost now. any advice? thank you.
slade powers is offline   Reply With Quote
Old 12-22-2010, 12:27 PM   PM User | #12
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Now you're getting a MySQL error.

I question the use of spaces and especially single quotes you used for MySQL column names.

It's my opinion that you should change your variable name spaces to underscore,
and eliminate any special characters (like the single quote ... baby's ).

You would have to change all of those within your MySQL admin and also in the script.
mlseim is offline   Reply With Quote
Old 12-22-2010, 07:36 PM   PM User | #13
slade powers
New Coder

 
Join Date: Dec 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
slade powers is an unknown quantity at this point
Smile i got a little bit further



things are looking up! thanks. i followed your suggestions and it appears to be working

i removed the spaces, the hyphen in the email field/variable and rid myself of the spaces ( i did not include the underscore as you suggested...if that's alright). i did this for the html, php and myphpadmin fields

PHP Code:
$yourfirstname $_POST['YourFirstName'];
$yourlastname $_POST['YourLastName'];
$yourphonenumber $_POST['YourPhoneNumber'];
$youremailaddress $_POST['YourEmailAddress'];
$babysfirstname $_POST['BabysFirstName'];
$babysmiddlename $_POST['BabysMiddleName'];
$babyslastname $_POST['BabysLastName'];
$babysbirthdate $_POST['BabysBirthdate'];
$babysage $_POST['BabysAge'];
$babysheight $_POST['BabysHeight'];
$babysweight $_POST['BabysWeight'];
$babyseyecolor $_POST['BabysEyeColor'];
$babyshaircolor $_POST['BabysHairColor'];
$babysethicity $_POST['BabysEthnicity'];


mysql_select_db("xxx"$con);
          
$sql="INSERT INTO register (YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName,
BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ('$yourfirstname',
'$yourlastname', '$yourphonenumber', '$youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname',
'$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')"
;
          

 
mysql_query($sql$con) or die ("<br>Query string: $sql<br>Produced error: " mysql_error() . '<br>'); 
i haven't tested all the fields yet but i get no exception and i can see the data in my database table!!!!! so far this has been a total success.

i'm going to re-include that heading script in the which jumps to the checkbox form. is it just possible that you could walk me through the steps of setting up the php script of the form?

Code:
<form id="form1" name="form1" method="post" action="">
          <table width="451">
            <tr>
              <td width="627"><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="film" id="CheckboxGroup1_0" />
                  Film</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="television (cmmercials, movies)" id="CheckboxGroup1_1" />
                  Television (commercials/movies)</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="radio" id="CheckboxGroup1_2" />
                  Radio</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="magazines" id="CheckboxGroup1_3" />
                  Magazines</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="newspaper" id="CheckboxGroup1_4" />
                  Newspaper</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="catalogs" id="CheckboxGroup1_5" />
                  Catalogs</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="photography" id="CheckboxGroup1_6" />
                  Photograpy</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="web" id="CheckboxGroup1_7" />
                  Web</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="Fashion" id="CheckboxGroup1_8" />
                  Fashion</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="modeling" id="CheckboxGroup1_9" />
                  Modeling</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="sittings (for portraits)" id="CheckboxGroup1_10" />
                  Sittings (for portraits)</label>
              </h3></td>
            </tr>
            <tr>
              <td><h3>
                <label>
                  <input type="checkbox" name="CheckboxGroup1" value="events" id="CheckboxGroup1_11" />
                  Events</label>
              </h3></td>
            </tr>
          </table>
          <div></div>
        </form>
i have yet to set up a table and do the php for the form. and actually its a set of different forms over several pages. i know it seems like its too much; to do different forms on different pages but i'm looking to provide a different type of experience where filling in the form isn't so tedious; i'm trying to add a little more than just the form submitting.
but i know others need your help too! you're very valuable. if you couldn't help me any further you really did hook me up. thank you very very much.
slade powers is offline   Reply With Quote
Old 12-22-2010, 08:21 PM   PM User | #14
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Multiple page forms can be pretty tricky... the trick is how to bring the data from each page over to the next page. You can save the data into a database, or use sessions... at any rate you'll have some good experience under your belt once you're done
__________________
Fumigator is offline   Reply With Quote
Old 12-22-2010, 08:23 PM   PM User | #15
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
So let me get this straight ...

You are going to have several forms.
Between each form, you will save the information for that form before you display the next one?

That's a good plan, so the user doesn't have to start all over if they get halfway and
decide to quit (and come back later).

So, you already have the "username" field ... you will have to add a field where the
user can enter a "password" (enter it twice to validate).

By doing it that way, at the very beginning of each page (script) that has a form,
you will need to check to see if the user has already filled it out. Because you don't
know who is currently viewing your form, you will need to have some way for the user
to "login" ... to see if they already have their name in the database. If they have their
name in your database, that means they previously filled-out, at least, the first form.

You can then determine where they left-off, or quit the form(s). This will also be a way
to give the user a "user profile" page where they can modify, or correct any wrong
information.

==================

On post #13, you're now showing us a form with checkboxes.
is that the 2nd form that will appear for the user?

Are you questioning how to process the checkboxes?


EDIT:
There are some "security issues" you will need to address, in particular,
the use of "user input" being allowed to be used in a SQL query.
I just don't want to throw too many things at you, at one time.

Just know that any variable values provided by a user (site visitor) should be
sanitized if you plan on using it within a query. It will stop users from
injecting their own queries into your database.

The red part added to all user defined variables:

$yourfirstname = mysql_real_escape_string($_POST['YourFirstName']);
$yourlastname = mysql_real_escape_string($_POST['YourLastName']);

.
.
. etc.



.

Last edited by mlseim; 12-22-2010 at 08:38 PM..
mlseim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:37 PM.


Advertisement
Log in to turn off these ads.