Jump to content

feedback form


schoolmommy

Recommended Posts

Hi!

 

I am fairly new to php and have a question about a feedback form that I'm writing. I have the form built (code below). I had asked a question before about sessions, but that's not what I need I've found out.

 

I have radio buttons for the person to choose what credit card they want to use, and I need to know if they will be attending an Awards Event. There is a hyperlink for confirming the order but it has to be invisble to begin with but display after the "submit" button has been clicked.

 

I guess what I need the form to do is to have the user enter their data into the feedback form and then have it spit it back out on a confirmation page. I've done this in aspx.net (using vb), but this is a lot more difficult for me to get. I know that the code for the php is not complete; just not sure how to do the file open, etc.

 

Thanks!

 

**************************************

HTML Code

**************************************

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

    <title>Rough Riders Rodeo</title>

</head>

<body>

    <table border="0">

        <caption>

            <h1>

            Rough Riders Rodeo</h1>

        </caption>

        <tr>

            <td style="width: 397px">

                Num. of Tickets</td>

            <td style="width: 456px">

                <input id="txtTickets" name="txtTickets" style="width: 48px" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Name</td>

            <td style="width: 456px">

                <input id="txtName" name="txtName" size="40" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Address</td>

            <td style="width: 456px">

                <input id="txtAddress" name="txtAddress" size="40" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                City</td>

            <td style="width: 456px">

                <input id="txtCity" name="txtCity" size="30" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                State</td>

            <td style="width: 456px">

                <input id="txtState" name="txtState" size="2" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Zip Code</td>

            <td style="width: 456px">

                <input id="txtZip" name="txtZip" size="10" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Phone#</td>

            <td style="width: 456px">

                <input id="txtPhone" name="txtPhone" size="13" type="text" />

                (111-111-1111)</td>

        </tr>

        <tr>

            <td style="width: 397px; height: 45px;">

                Credit Card

                Number</td>

            <td style="width: 456px; height: 45px;">

                <input id="txtCreditCard" name="txtCreditCard" size="15" type="text" />

                <input id="radCC" type="radio" style="width: 20px" name="radCC" title="Visa" value="on" />

                Visa

                <input id="radCC" type="radio" style="width: 19px" checked="CHECKED" name="radCC" title="MasterCard" />

                MCard  <input id="radCC" type="radio" style="width: 18px" name="radCC" title="Discovery" />

                Discov  <input id="radCC" type="radio" style="width: 17px" name="radCC" title="AmX" />

                AmX</td>

        </tr>

        <tr>

            <td style="width: 397px">

                Expiration Date</td>

            <td style="width: 456px">

                <input id="txtExpire" name="txtExpire" size="10" type="text" />

                (xx/xx/xxxx)</td>

        </tr>

        <tr>

            <td style="width: 397px; height: 26px;">

                Attnding Awards Event

                <input id="radYesNo" name="radYesNo" title="AwardsYes" type="radio" />

                Yes

                <input id="radYesNo" name="radYesNo" title="AwardsNo" type="radio" />

                No</td>

            <td style="width: 456px; height: 26px;">

                <input id="txtAwardsYesNo" name="txtAwardsYesNo" size="30" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                </td>

            <td style="width: 456px">

                <input id="btnSubmit" name="btnSubmit" type="submit" value="submit" />

                <input id="btnOrderConfirmatin" name="btnOrderConfirmation" title="Order Confirmation"

                    type="button" value="Order Confirmation" /></td>

        </tr>

    </table>

   

</body>

</html>

 

***********************************

PHP code

**********************************

<?php

 

If btnOrderConfirmation = False Then

btnOrderConfirmation = True

End If

 

If radYesNo = True Then

txtAwardsYesNo = "Will attend Awards Event"

Else

txtAwardsYesNo = "Will not be attending Awards Event"

End If

?>

<html>

<head>

<title>Order Confirmation</title>

</head>

<body>

<h1>Order Confirmation</h1>

<form method="POST" Action="frmConfirm.php">

<table border="0">

        <caption>

            <h1>

            Rough Riders Rodeo</h1>

        </caption>

        <tr>

            <td style="width: 304px">

                Num. of Tickets</td>

            <td style="width: 456px">

                <input id="txtTickets" name="txtTickets" style="width: 48px" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 304px">

                Name</td>

            <td style="width: 456px">

                <input id="txtName" name="txtName" size="40" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 304px">

                Address</td>

            <td style="width: 456px">

                <input id="txtAddress" name="txtAddress" size="40" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 304px">

                City</td>

            <td style="width: 456px">

                <input id="txtCity" name="txtCity" size="30" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 304px">

                State</td>

            <td style="width: 456px">

                <input id="txtState" name="txtState" size="2" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 304px">

                Zip Code</td>

            <td style="width: 456px">

                <input id="txtZip" name="txtZip" size="10" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 304px">

                Phone#</td>

            <td style="width: 456px">

                <input id="txtPhone" name="txtPhone" size="13" type="text" />

                (111-111-1111)</td>

        </tr>

        <tr>

            <td style="width: 397px; height: 45px;">

                Credit Card

                Number</td>

            <td style="width: 456px; height: 45px;">

                <input id="txtCreditCard" name="txtCreditCard" size="15" type="text" />

                <input id="radCC" type="radio" style="width: 20px" name="radCC" title="Visa" value="on" />

                Visa

                <input id="radCC" type="radio" style="width: 19px" checked="CHECKED" name="radCC" title="MasterCard" />

                MCard  <input id="radCC" type="radio" style="width: 18px" name="radCC" title="Discovery" />

                Discov  <input id="radCC" type="radio" style="width: 17px" name="radCC" title="AmX" />

                AmX</td>

        </tr>

        <tr>

            <td style="width: 304px">

                Expiration Date</td>

            <td style="width: 456px">

                <input id="txtExpire" name="txtExpire" size="10" type="text" />

                (xx/xx/xxxx)</td>

        </tr>

        <tr>

            <td style="width: 304px">

                <input id="ckbxAwards" name="ckbxAwards" size="1" type="checkbox" />Check here if

                you will be attending Awards Event?</td>

            <td style="width: 456px">

                <input id="txtAwardsYesNo" name="txtAwardsYesNo" size="30" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 304px">

                </td>

            <td style="width: 456px">

                <input id="btnSubmit" name="btnSubmit" type="submit" value="submit" />

                <input id="btnOrderConfirmatin" name="btnOrderConfirmation" title="Order Confirmation"

                    type="button" value="Order Confirmation" /></td>

        </tr>

    </table>

   

</form>

</body>

</html>

 

 

 

Link to comment
Share on other sites

Hi schoolmommy,

 

Taking a quick look at your code I see some errors. Your if statements don't use the right syntax. There is no such thing as "End If". Also you should really use form validation and other security tools when gathering credit card information.

 

Questions to help us help you:

 

Do you want this information to be submitted into a database after they confirm it?

If the information is incorrect, do you want the user to be able to go back the form and edit the information?

 

What you're seeking to do is quite easy (even for newbie like me) but I can see that you're new to PHP. You should check out the freelance section and maybe hire someone to do this for you, or I could do it.

 

SC

Link to comment
Share on other sites

Hi!

 

The info. just has to "echo" back to the screen the data that they have entered on the feedback form. It doesn't need to go into a database. For now it's a test. 

 

When they hit the "submit" button, it should bring up the data the user entered and the button "order confirmation" The user then clicks that button and the data is echoed back to the screen.

 

I know that in aspex.net validation is much easier than it is in php; at least that's how it appears.

 

Thanks!

Link to comment
Share on other sites

your top form doesn't have < form >..< /form > tags

 

even though this has php tags

<?php

If btnOrderConfirmation = False Then
   btnOrderConfirmation = True
End If

If radYesNo = True Then
   txtAwardsYesNo = "Will attend Awards Event"
Else
   txtAwardsYesNo = "Will not be attending Awards Event"
End If
?>

 

the syntax is VB.

 

http://www.php.net/manual/en/language.basic-syntax.php

Link to comment
Share on other sites

Hi!

 

I've made some modifications to the program. Now when I hit the submit button, the order confirmation page comes up, but it doesn't have any of the data from the feedback form. I also don't think I did the order confirmation button right. I really want it to not show up on the main page until I hit the submit button, but that isn't working correctly either.

 

Any suggestions?

 

***************************************

html code

***************************************

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

    <title>Kathy Gibson Lab 4php Prob. 3</title>

</head>

<body>

<form name="form1" id="form1" method="post" action="frmConfirm.php">

    <table border="0">

        <caption>

            <h1>

            Rough Riders Rodeo</h1>

        </caption>

        <tr>

            <td style="width: 397px">

                Num. of Tickets</td>

            <td style="width: 456px">

                <input id="txtTickets" name="txtTickets" style="width: 48px" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Name</td>

            <td style="width: 456px">

                <input id="txtName" name="txtName" size="40" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Address</td>

            <td style="width: 456px">

                <input id="txtAddress" name="txtAddress" size="40" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                City</td>

            <td style="width: 456px">

                <input id="txtCity" name="txtCity" size="30" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                State</td>

            <td style="width: 456px">

                <input id="txtState" name="txtState" size="2" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Zip Code</td>

            <td style="width: 456px">

                <input id="txtZip" name="txtZip" size="10" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                Phone#</td>

            <td style="width: 456px">

                <input id="txtPhone" name="txtPhone" size="13" type="text" />

                (111-111-1111)</td>

        </tr>

        <tr>

            <td style="width: 397px; height: 45px;">

                Credit Card

                Number</td>

            <td style="width: 456px; height: 45px;">

                <input id="txtCreditCard" name="txtCreditCard" size="15" type="text" />

                <input id="radCC" type="radio" style="width: 20px" name="radCC" value="Visa" />Visa 

                <input id="radCC" type="radio" style="width: 19px" checked="CHECKED" name="radCC" value="MC" />MC

                 <input id="radCC" type="radio" style="width: 18px" name="radCC" value="Discv" />Discv

                 <input id="radCC" type="radio" style="width: 17px" name="radCC" value="AmX" />AmX</td>

        </tr>

        <tr>

            <td style="width: 397px">

                Expiration Date</td>

            <td style="width: 456px">

                <input id="txtExpire" name="txtExpire" size="10" type="text" />

                (xx/xx/xxxx)</td>

        </tr>

        <tr>

            <td style="width: 397px; height: 26px;">

                Attnding Awards Event

                <input id="radYesNo" name="radYesNo" type="radio" value="Yes" />

                Yes

                <input id="radYesNo" name="radYesNo" type="radio" value="No" />

                No</td>

            <td style="width: 456px; height: 26px;">

                <input id="txtAwardsYesNo" name="txtAwardsYesNo" size="30" type="text" /></td>

        </tr>

        <tr>

            <td style="width: 397px">

                </td>

            <td style="width: 456px">

                <input id="btnSubmit" name="btnSubmit" type="submit" value="Submit" />

                <input id="btnOrderConfirmatin" name="btnOrderConfirmation" title="Order Confirmation"

                    type="button" value="Order Confirmation" disabled="disabled" /></td>

        </tr>

    </table>

</form>   

</body>

</html>

 

********************************************

php code

********************************************

<?php

 

If ($btnOrderConfirmation == disabled)

{

  $btnOrderConfirmation == invisible;

}   

 

If ($btnOrderConfirmation != disabled)

{

  $btnOrderConfirmation == visible;

}

If ($radYesNo == True)

{

$txtAwardsYesNo == "Will attend Awards Event" || txtAwardsYesNo == "Will not be attending Awards Event";

}

?>

<html>

<head>

<title>Order Confirmation</title>

</head>

<body>

<h1>Order Confirmation</h1>

<table border="0">

        <caption>

            <h1>

            Rough Riders Rodeo</h1>

        </caption>

        <tr>

            <td style="width: 304px">

                Num. of Tickets</td>

            <td style="width: 456px">

                <input id="txtTickets" name="txtTickets" style="width: 48px" type="text" />

              <?php echo "$txtTickets" ?>

            </td>

          </tr>

          <tr>

            <td style="width: 304px">

              Name

            </td>

            <td style="width: 456px">

              <input id="txtName" name="txtName" size="40" type="text" />

              <?php echo "$txtName" ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

                Address</td>

            <td style="width: 456px">

                <input id="txtAddress" name="txtAddress" size="40" type="text" />

              <?php echo "$txtAddress" ?>

            </td>

          </tr>

          <tr>

            <td style="width: 304px">

              City

            </td>

            <td style="width: 456px">

              <input id="txtCity" name="txtCity" size="30" type="text" />

              <?php echo "$txtCity" ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

                State</td>

            <td style="width: 456px">

                <input id="txtState" name="txtState" size="2" type="text" />

              <?php echo "$txtState" ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

                Zip Code</td>

            <td style="width: 456px">

                <input id="txtZip" name="txtZip" size="10" type="text" />

              <?php echo "$txtZip" ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

                Phone#</td>

            <td style="width: 456px">

                <input id="txtPhone" name="txtPhone" size="13" type="text" />

              <?php echo "$txtPhone" ?></td>

        </tr>

        <tr>

          <td style="width: 397px; height: 45px;">

            Credit Card

            Number

          </td>

          <td style="width: 456px; height: 45px;">

            <input id="txtCreditCard" name="txtCreditCard" size="15" type="text" />

            <input id="radCC" type="radio" style="width: 20px" name="radCC" title="Visa" value="on" />

            Visa

            <input id="radCC" type="radio" style="width: 19px" checked="CHECKED" name="radCC" title="MasterCard" />

            MCard <input id="radCC" type="radio" style="width: 18px" name="radCC" title="Discovery" />

            Discov <input id="radCC" type="radio" style="width: 17px" name="radCC" title="AmX" />

            AmX <?php echo "$radCC" ?></td>

        </tr>

        <tr>

          <td style="width: 304px">

                Expiration Date</td>

            <td style="width: 456px">

                <input id="txtExpire" name="txtExpire" size="10" type="text" />

              <?php echo "$txtExpire" ?></td>

        </tr>

       

              <?php echo "$txtAwardsYesNo" ?></td>

       

        <tr>

            <td style="width: 304px">

                </td>

            <td style="width: 456px">

               

               

                    <a href="default.html">Main Page</a>

                                </td>

        </tr>

    </table>

   

</body>

</html>

*******************************************

Thanks!

 

Link to comment
Share on other sites

Hi!

 

Made those changes and it only echo's out the 1st 2 txt boxes.

 

Here is what I changed the php to:

 

**********************************************

<?php

 

If ($btnOrderConfirmation == disabled)

{

  $btnOrderConfirmation == invisible;

}   

 

If ($btnOrderConfirmation != disabled)

{

  $btnOrderConfirmation == visible;

}

If ($radYesNo == True)

{

$txtAwardsYesNo == "Will attend Awards Event" || txtAwardsYesNo == "Will not be attending Awards Event";

}

 

$txtTickets = $_POST['txtTickets'];

$txtName = $_POST['txtName'];

$txtAddress = $_POST['$txtAddress'];

$txtCity = $_POST['$txtCity'];

$txtState = $_POST['$txtState'];

$txtZip = $_POST['$txtZip'];

$txtPhone = $_POST['$txtPhone'];

$radCC = $_POST['$radCC'];

$txtExpire = $_POST['$txtExpire'];

$txtAwardsYesNo = $_POST['$txtAwardsYesNo'];

 

 

 

?>

<html>

<head>

<title>Order Confirmation</title>

</head>

<body>

<h1>Order Confirmation</h1>

<table border="0">

        <caption>

            <h1>

            Rough Riders Rodeo</h1>

        </caption>

        <tr>

            <td style="width: 304px">

                Num. of Tickets</td>

            <td style="width: 450px"><?php echo "$txtTickets"; ?>

            </td>

          </tr>

          <tr>

            <td style="width: 304px">

              Name

            </td>

            <td style="width: 450px"><?php echo "$txtName"; ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

              Address</td>

           

            <td style="width: 450px"><?php echo "$txtAddress"; ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

              City

            </td>

           

            <td style="width: 450px"><?php echo "$txtCity"; ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

              State</td>

           

            <td style="width: 450px"><?php echo "$txtState"; ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

              Zip Code</td>

           

            <td style="width: 450px"><?php echo "$txtZip"; ?></td>

        </tr>

        <tr>

            <td style="width: 304px">

              Phone#</td>

           

            <td style="width: 450px"><?php echo "$txtPhone"; ?></td>

        </tr>

        <tr>

            <td style="width: 304px;">

              Credit Card Number

            </td>

         

          <td style="width: 450px"><?php echo "$radCC"; ?></td>

        </tr>

        <tr>

          <td style="width: 304px">

            Expiration Date</td>

           

          <td style="width: 450px"><?php echo "$txtExpire"; ?></td>

        </tr>

       

          <td style="width: 450px"><?php echo "$txtAwardsYesNo"; ?></td>

        <tr>

          <td style="width: 304px">

                </td>

          <td style="width: 456px">

               

               

                    <a href="default.html">Main Page</a>

                                </td>

        </tr>

    </table>

   

</body>

</html>

*********************************************

 

Why would it only print out the 1st 2 echo's and not the others?

Link to comment
Share on other sites

Hi Schoolmommy,

 

$txtAddress = $_POST['$txtAddress'];
$txtCity = $_POST['$txtCity'];
$txtState = $_POST['$txtState'];
$txtZip = $_POST['$txtZip'];
$txtPhone = $_POST['$txtPhone'];
$radCC = $_POST['$radCC'];
$txtExpire = $_POST['$txtExpire'];
$txtAwardsYesNo = $_POST['$txtAwardsYesNo'];

 

Would need to take out the Dollar sign on the post side:

 

$txtAddress = $_POST['txtAddress'];
$txtCity = $_POST['txtCity'];
$txtState = $_POST['txtState'];
$txtZip = $_POST['txtZip'];
$txtPhone = $_POST['txtPhone'];
$radCC = $_POST['radCC'];
$txtExpire = $_POST['txtExpire'];
$txtAwardsYesNo = $_POST['txtAwardsYesNo'];

 

It must match your form name for that field. You then create the variable using the $ sign.

 

That is why only

$txtTickets = $_POST['txtTickets'];
$txtName = $_POST['txtName'];

 

was working.

 

Also, when you post in the forums, please use the CODE tags... a lot easier to read so we can help you better.

 

SC

Link to comment
Share on other sites

Hi!

 

Thanks for your help! Everything is working except for two things!!!

 

I'm not getting the Order Confirmation button to be hidden on the main screen and then showing up when the submit button is clicked. Also, the "Attending Awards Event" still isnt' working right. I'm still not sure that I have the code right for either of these. Obviously, I dont'!!!  ;)

 

I'm fairly new to this forum. What are code tags and how do you use them?

 

Again, thanks!

Link to comment
Share on other sites

If ($_POST['btnOrderConfirmation'] == disabled) 
{
  $btnOrderConfirmation == invisible;
}    

If ($_POST['btnOrderConfirmation'] != disabled) 
{
  $btnOrderConfirmation == visible;
}
If ($_POST['radYesNo'] == Yes)
{
$txtAwardsYesNo == "Will attend Awards Event";
}

If ($_POST['radYesNo'] == No)
{
$txtAwardsYesNo == "Will not be attend Awards Event";

} 

 

Hope that works!

 

This part of my code is still not working. I made changes to what I had earlier, but it still doesn't work. I've been trying to find documentation to show how to make buttons invisible until you need them. In this case, the Confirmation button should be invisible until the user clicks the submit button. Once they do that, and the confirmation button is clicked, then the data the user entered is echoed back.

 

I think I may left some more code out. Should I have the screen repeat what it shows when the submit button is clicked and then have the echo stuff come after the confirmation button is clicked.

 

I'm getting so confused here!!!!!! LOL

 

 

Link to comment
Share on other sites

<?php
if ($_POST['btnOrderConfirmation'] == 'disabled') 
{
  $btnOrderConfirmation == invisible; // this code will be excuted if it meets the "if statement"
} else {
  $btnOrderConfirmation == visible; //if it does not it will execute this code
}


if ($_POST['radYesNo'] == 'Yes')
{
   $txtAwardsYesNo == "Will attend Awards Event"; // this code will be excuted if it meets the "if statement"
} else {
   $txtAwardsYesNo == "Will not be attend Awards Event"; //if it does not it will execute this code
} 
?>

 

But make sure your if statements (this code between the parenthesis) is correct.

You must also now echo $txtAwardsYesNo and run $btnOrderConfirmation somewhere in your code.

Link to comment
Share on other sites

Hi!

 

The way I've been asked to do this is to include a hyperlink for confirming the order. Make the link invisible to begin with, but display it after the submit button has been clicked.

 

I made the corrections to the if/else statements, but they still don't seem to want to work. I'm continuing to take a look to see why.

 

Thanks!

Link to comment
Share on other sites

I'm trying to put some validation into my form. When I fill the data and hit the submit I get the blank default page. Do I have to do every text field including the radio buttons?

 

Thanks!

 

// Check for blank data
if (($txtTickets == "") || ($txtName == "") || ($txtAddress == "") || ($txtCity == "") || ($txtState == "") || ($txtZip == "") || ($txtPhone == ""))
{
	header("Location: default.html");
	exit;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.