Jump to content

JBuss1503

New Members
  • Posts

    8
  • Joined

  • Last visited

JBuss1503's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for your help so far. I have made some changes including what you gave me and my code now looks like this <form action="admin.php" method="POST" name="authorisation"><br> <!--Product Comment Box--><br> <p>Please enter your 4<br> digit authorisation code:<br> <br><input type="text" name="code"/></p><br> <input type="submit" value="Log In"/> </form> <?php if(isset($_POST['code']) && $_POST['code'] != 210392) { echo "https://www.google.co.uk"; } ?> When I run it, I type I can leave it blank and it will take me to admin.php instead of google. Do I need to remove any code and how do I get it so that if the incorrect code is inputted it wont load the page. I having only started html/php last week so I am very new to this and all help is appreciated
  2. No. Can I change the 'if' code so that it knows to check the content of the form? THanks
  3. It appears I was missing a bracket in the line 23. However I now get this error Notice: Undefined variable: authorisation in /web/users/l1071039/bobbin/login.php on line 21 https://www.google.co.uk
  4. Hi Community, I have a page on my website which includes a form and a submit button. If a user enters the correct 6 digit code (210392) it will take them to a another page (Google in this example). However I get an error when I run it. My code is below: <?php session_start(); include('connection.php'); ?> <div id="authorise"> <form action="admin.html" method="POST" name="authorisation"><br> <!--Product Comment Box--><br> <p>Please enter your 4<br> digit authorisation code:<br> <br><input type="text" name="code"/></p><br> <input type="submit" value="Log In"/> </form> <?php if ( ($authorise != 210392) echo "https://www.google.co.uk"; ?> The error I get is: All help is greatly appreciated. Thanks in advance
  5. Thanks I have done that and it has arranged into a table. Is there a way I can style the headings and the data within the headings (centre all of the text within the grid for example)? Many Thanks
  6. Hi all, I was wondering if you can help me with an issue I am having with my website. I am very new to php/html/css and mysql so I know very little. I have an order form on my website which when filled in send data to my database. I then have an admin page on my site which shows the data in the database. However, I need the data to be stored in a table with a row containing the column name and then each row showing the actual data underneath. Would like it in a grid sort of format. My current code is: <!doctype html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <link href="css/reset.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container2"> <div id="adminpanel"> Admin Page <div id="showorders"><u>Orders</u></div> <?php include('connection.php'); $result = mysql_query("SELECT * FROM orderform"); while($row = mysql_fetch_array($result)) { echo "<span style='color: #333; width: 200px; height: 200px; padding: 1px; border: 1px solid #ff9900;'>" . $row['product'] . " " . $row['productcomments'] . " " . $row['name'] . " " . $row['address'] . " " . $row['age'] . " " . $row['delivery'] . "</span>" ; echo "<br>"; } ?> <div id="showreviews"><u>Reviews</u></div> <?php $result = mysql_query("SELECT * FROM reviewform"); while($row = mysql_fetch_array($result)) { echo "<span style='color: #333; width: 200px; height: 200px; padding: 5px; border: 1px solid #ff9900;'>" . $row['name'] . " " . $row['product'] . " " . $row['comment'] . "</span>" ; echo "<br>"; echo $row['name'] . " " . $row['product'] . " " . $row['comment'] ; echo "<br>"; } ?> </div> </div> </body> This code puts a border around each row but doesnt seperate each column and doesnt show a header. Ultimately, I am going to want to sort each order by different criteria e.g alphabetical, date ordered, product type. All help is really appreciated as I am really pushed for time and a complete beginner. Thanks Jonathan
  7. Hi, thanks for your quick response. I was getting parse errors on the lines in which I had the curly quotations. I changed those to straight " ones and got the following message when I submitted the form: Thanks again
  8. Hi there, newbie to this forum and newbie to PHP (infact I only started "attempting" to use it today) I have a contact form on https://scm-intranet.tees.ac.uk/users/l1071039/bobbin/order.html And I have a table set up on MySQL named "orderform" According to my order.html, the form data should be posted to order.php (code can be seen below) <?php $product = $_POST['product']; $productcomments = $_POST['productcomments']; $name = $_POST['name']; $address = $_POST['address']; $age = $_POST['age']; $delivery = $_POST['delivery']; ?> <?php $host=”mysql.scm.tees.ac.uk”; $user_name=”l1071039”; $pwd=”+i^RR9b7”; $database_name=”l1071039”; $db=mysql_connect($host, $user_name, $pwd); if (mysql_error() > “”) print mysql_error() . “<br>”; mysql_select_db($database_name, $db); if (mysql_error() > “”) print mysql_error() . “<br>”; ?> <?php $query = “insert into orderform (product, productcomments, name, address, age, delivery) values (‘” . $product . “‘, ” . $productcomments . “, ‘” . $name . “‘, ‘” . $address . “. $age . “. $delivery . “‘)”; $qresult = mysql_query($query); ?> However when I fill the form in I get a snippet of code? How do I get it so when the submit button is clicked, it returns to the Home Page, and how can I view the data that was inputted? Many Thanks in advance
×
×
  • 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.