Jump to content

schoolmommy

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

schoolmommy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi! I tried that and still don't see anything on the screen. I went to mysql command line client and typed the Grant All... Is there something else that might keep me from seeing the data in the table? Thanks!
  2. Hi! I have a program that uses php & mysql. I built the table called "customer" in mysql and an index.htm file and a php file. Basically, the user enteres the data into the form, hits the submit button and the data is entered into the table. I've never worked with mysql and don't really have a clue about how it works. I've worked with Access some and know a lot more about how it works. But for this progam, I have to use mysql. My problem is this - I don't know how to view the data in mysql to make sure that the data enter in the form is in the table. Someone said I needed to put a select statement in my php, but didn't say where it should go. I'm including the php code so hopefully someone can tell me what I'm doing wrong. Thanks! <!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>Insert into database</title> </head> <body> <?php //Get data from form extract($_POST); //Check for blank if (($txtName == "") || ($txtemail == "") || ($txtusername == "") || ($txtpassword == "") || ($txtconfirmpass == "") || ($txtaddress == "") || ($txtcity == "") || ($txtstate == "") || ($txtzip == "") || ($txtphone == "")) { header("Location: index.htm"); exit; } if ($txtpassword != $txtconfirmpass) { header("Location: index.htm"); exit; } $connect = @mysql_connect("localhost","****","****") or die(mysql_error()); $db = @mysql_select_db("customer",$connect) or die(mysql_error()); $sql = "INSERT INTO customer VALUES ('$txtname','$txtemail', '$txtusername', '$txtpassword', '$txtaddress', '$txtcity', '$txtstate', '$txtzip', '$txtphone')"; $result = @mysql_query($sql,$db) or die(mysql_error()); SELECT * FROM [customer]; ?> <?php echo "$result"; ?> </body> </html> username & password intentinally *** 'd
  3. As I said, I'm very, very new to php & mysql. If I used a statement like: SELECT * FROM [customer];//name of table where do I put the code? Should it go before the $result=... statement? Outside the php? Thanks!
  4. Hi! I'm just getting started with the php and just started learning mysql. This is probably a very stupid question, but I'll ask anyway! I have made a table in mysql called "customer" I made my index page with the table to hold the info. and my php file with all of the connection info. (see below). I've tested the table by adding data. My stupid question is - how do I check the table to see if the data I input is there. In Access, I think you would just open the table and view the data. But as I've said, I don't know mysql. Help is always appreciatd! <body> <?php //Get data from form extract($_POST); //Check for blank if (($txtName == "") || ($txtemail == "") || ($txtusername == "") || ($txtpassword == "") || ($txtconfirmpass == "") || ($txtaddress == "") ($txtcity == "") || ($txtstate == "") || ($txtzip == "") || ($txtphone == "")) { header("Location: index.htm"); exit; } if ($txtpassword != $txtconfirmpass) { header("Location: index.htm"); exit; } $connect = @mysql_connect("localhost","****","*****") or die(mysql_error()); $db = @mysql_select_db("customer",$connect) or die(mysql_error()); $sql = "INSERT INTO customer VALUES ('$txtname','$txtemail', '$txtusername', '$txtpassword', '$txtaddress', '$txtcity', '$txtstate', '$txtzip', '$txtphone')"; $result = @mysql_query($sql,$db) or die(mysql_error()); ?> <?php echo "$result"; ?> </body> </html> ****username & password blanked out on purpose*********
  5. 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; }
  6. I got the Awards part to work. I did a form just like this in aspx.net (using vb) and it was so much easier! Now to get the confirmation button working! Onward & upwards!!!
  7. 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!
  8. 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
  9. 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!
  10. 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?
  11. I saw where I had forgotten to put the ";" in the echo, but fixed that and still doens't give any output on the confirmation page. ???
  12. 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!
  13. 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!
  14. 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>
  15. Hi! There should have been some astricks between the first html code and where the php starts. These are two different files. The first is a default.html file and the second is the php file.
×
×
  • 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.