Jump to content

dazz_club

Members
  • Posts

    103
  • Joined

  • Last visited

Everything posted by dazz_club

  1. Hi there, I am setting up an email bulletin which contains a unique reference number which then can be used to order a free product from me. when the user clicks on my desired link in my bulletin, it will then go to a different page on then internet. This page will ask for the reference number to be typed in which allows you to proceed to the order form. My option is to set up user access where the user will simply type in the reference number given to them in the email bulletin. However there could be a possibility of them not really reading or even remembering the number at all. So what i am asking, can the page (ie the order form, or some script in this page) read the url the user comes from and if it sees a word/that it is looking for, it then allows you to go to the order page atuomaticly. is this possible?? kind regards Darren
  2. aaa, nope your eyes are fine, i had an extra variable $telephone. Cheers I never gone be a good developer if i cant see little things like that. cheers again mate . kind regards Dazzclub
  3. Hi, Thats weird, because I used the exact same method on another project and it worked. I'll change it now to what you suggested and post back how i got on. cheers again. kind regards Dazzclub
  4. Hi all, I have an order form, order.php that inserts the users detail collected into a database. I have put an echo to display wether it has failed or it successfully inserted the details into the database. when i test it out and then submit the form it displays a successfull message. Sadly when i go to see it in the database, its not there. any help would be great heres my code for order.php <?php session_start(); require_once("includes/connection.php"); if(isset($_POST['submit'])) { $company_name=$_POST['company_name']; $company_email=$_POST['company_email']; $company_telephone_number=$_POST['company_telephone_number']; $address=$_POST['address']; $address_1=$_POST['address_1']; $address_2=$_POST['address_2']; $address_3=$_POST['address_3']; $town=$_POST['town']; $city=$_POST['city']; $post_code=$_POST['post_code']; $free_sample_of_room_thermometers=$_POST['free_sample_of_room_thermometers']; $errors .= (empty($post_code)) ? "<span class=\"emptyFields\">We reuqire your postcode.</span>" : ""; $errors .= (empty($company_name)) ? "<span class=\"emptyFields\">We require a company name.</span>" : ""; $errors .= (empty($company_telephone_number)) ? "<span class=\"emptyFields\">We need your telepone number to contact you.</span>" : ""; $errors .= (empty($company_email)) ? "<span class=\"emptyFields\">To help you, we require your email.</span>" : ""; //need to add country, product and state if (!$errors) { if(!get_magic_quotes_gpc()) { $company_name = addslashes($company_name); $company_email = addslashes($company_email); $company_telephone_number= addslashes($company_telephone_number); $address= addslashes($address); $address_1= addslashes($address_1); $address_2= addslashes($address_2); $address_3= addslashes($address_3); $town= addslashes($town); $city= addslashes($city); $post_code= addslashes($post_code); $free_sample_of_room_thermometers= addslashes($free_sample_of_room_thermometers); } @ $db = new mysqli('localhost', 'root', 'xx', 'xx'); if (mysqli_connect_errno()) { echo 'error'; } $query = " INSERT INTO order_enquiries (company_name, company_email, company_telephone_number, address, address_1, address_2, address_3, town, city, post_code, free_sample_of_room_thermometers ) VALUES ('".$company_name."', '".$company_email."', '".$company_telephone_number."', '".$telephone."', '".$address."', '".$address_1."', '".$address_2."', '".$address_3."', '".$town."', '".$city."', '".$post_code."', '".$free_sample_of_room_thermometers."')"; $result = $db->query($query); $success .= "<span class=\"emptyFields\">Thank you, your enquiry has been sent.</span>"; //need to add country, product and state if ($success); } } ?> <?php echo ($errors) ? "<p class=\"errorSentence\">Some fields have not been completed: $errors</p>" : ""; ?> <?php echo ($success); ?> kind regards Dazzclub
  5. Hi wildteen88, Sorry for not getting back to you quick. The code you gave worked like a charm, i changed it slightly and it still works ,lol. Thanks again for all your help. kind regards Dazzclub
  6. o rite, the reason i was performing a query is that i was using the username to help me pull out some data from a different table. i have a members table which lists the id, password and username and then i have contacts which has their username along , some other address fields. so i was using the username that was entered via the form to then be used to the login_success.php to pull out their data. thanks again for your input
  7. Hi there, Back again, sorry. ok as i mentioned in my previous post. I would like to use the user name provied (from the logn pag or the one set in the database)to be passed to the login_success.php so it can then use $username in a query to pull out the correct data for that particular user. something like this' <?php session_start(); require_once 'includes/connection.php'; // check that the user has logged in if(isset($_SESSION['is_logged_in']) && $_SESSION['is_logged_in'] !== true || !isset($_SESSION['is_logged_in'])) { die('You must be logged in to view this page!'); } $username = isset($_GET['username ']); $sql = "SELECT * FROM contacts WHERE username = '$username' "; If ($r = mysqli_query($connection, $sql)) { //sending the query to the mySQL server While ($row = mysqli_fetch_array($r)) { //inputs the data into the table $username = $row['username']; } } ?> Am i on the right track or am i way off or should i do more research? cheers Dazzclub
  8. Thats great wildteen88 thanks alot!!! Now my next step is for the login_success.php script to pull out some data about me from another table using password , username or id as a unique field. Dont worry, i'll do my research and wont post for at least an hour, lol. Cheers again
  9. Hi wildteen88, I have changed it now so it looks like $password = md5($_POST['password']); Using my phpmyadmin i looked the my members database, clicked on the icon (you know the pencil icon) next to 1, darren, darren and changed the password function, from nothing to md5, using the drop down menu. I then tried the form and it worked. May i ask some more questions? The script you provided does that perform what i just mentioned above (i changed the function through phpmyadmin)? How can i give the password field in the database table the permanant function of using md5 instead of having to go round the back so to speak and change it. Or, again, is that what your sript performs? Thanks again dude. Dazzclub
  10. woahh i think we have gotton somewhere. I double checked the script, removed the md5 and when i tried the form it went to login_success.php and displayed Session data: Array ( [id] => 1 [username] => darren [password] => darren ) so thats good right?? I need to run your script as i havent done it yet. Cheers dude. Dazzclub
  11. I thought it might have been this so i removed md5 from here $password = md5($_POST['password']); so it looks like this $password = ($_POST['password']); double checked the username and password in the members section and completed the form and it didnt work but at this time i may have removed the quotes from the string i.e '$username'. I will double check. Thanks dude, i really appreciate your help on this.
  12. Sorry wildteen88 for removing the quotes. I strongly believe it must be the table, as when i enter the username (darren) and password (azzopardi) then press submit, it informs me i am using the "Wrong Username or Password". hmmmm. Thanks for all you help on this dude
  13. Hi wildteen88, I think we are getting somewhere and i am coming to the conclusion that the problem maybe my table that i am querying, $sql= "SELECT * FROM members WHERE username= $username AND password = $password"; As when i entered the username and password then pressed submit it displayed Query Error: Query: SELECT * FROM members WHERE username= darren AND password = 1ff6a143a805fa679534bd92eed02ed1 Error: Unknown column 'darren' in 'where clause' The members table looks like this (if this helps though) -- Table structure for table `members` -- CREATE TABLE `members` ( `id` int(4) NOT NULL auto_increment, `username` varchar(65) character set utf8 collate utf8_unicode_ci NOT NULL, `password` varchar(65) character set utf8 collate utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `members` -- INSERT INTO `members` (`id`, `username`, `password`) VALUES (1, 'darren', 'azzopardi'), (2, 'gracie', 'alice'); kind regards Dazzclub I will grab a coffe and look at this problem with fresh eyes.
  14. Hey thanks for getting back to me wildteen88. Cheers!!!!
  15. Hi BlueSkyIS Is that causing the login.php script "not to work" because md5() doesnt match?? Here goes.........
  16. Hi there charlieholder, I have successfully inserted your code into mine to see if a specific field is empty on my contact form. Many thanks Kind regards Dazzclub
  17. just done it, it was $row[image], no ' surrounding the word image. Thank you for your help. kind regards Dazzclub
  18. hi guys i am trying to echo out my row that is within an img src, but doesnt seem to work, any pointers?? Here is the code; .......$query = "SELECT * FROM products WHERE name LIKE \"%$search%\" OR category LIKE \"%$search%\" OR image LIKE \"%$search%\" OR type LIKE \"%$search%\" ORDER BY product_id DESC" . " LIMIT $offset, $rowsPerPage" ; $result = mysqli_query ($connection, $query)or die(mysqli_connect_errno() . "<p>With query:<br>$query"); while ($row = mysqli_fetch_assoc($result)){ echo "<ul style=\"font-weight:bold;list-style:none;padding:4px;margin:0px;\">"; echo "<li>"; echo $row['name']; echo "</li>"; echo "<li>"; echo $row['type']; echo "</li>"; echo "<li>"; echo "<img src=\"images/product-images/$row ['$image']\" />"; echo "</li>"; echo "<li>"; echo $row['category']. '<br />'; echo "</li>"; echo "</ul>"; echo "<li><a href=\"#\" style=\"font-size:8pt;color:red;\">more information >></a></li>"; echo "<div style=\"width:100%;height:5px;border-bottom:1px solid black;\"></div>"; kind regards Dazzclub
  19. Currently, i have put a check to see if any of the variables are empty if they are, it will echo 'you have forgotton something' if (!$first_name || !$last_name || !$email || !$telephone || !$company || !$address || !$address_a || !$address_b || !$address_c || !$town || !$city || !$postal_zip_code || !$comments) { echo 'you have forgotton something'; exit; } Using your code i will make it so the name of the field shows up if empty, be more sepcific , echo 'you have forgotton you last name'. kind regards Dazzclub
  20. Ok guys, The form is now inputting all of the data, so its complete. Well phase 1 is complete, what i plan to do next is have the form submit to an email address aswell and i also need to have some validation on this form aswell . so below is the finished script; <?php require_once("includes/connection.php"); ?> <?php $first_name=$_POST['first_name']; $last_name=$_POST['last_name']; $email=$_POST['email']; $telephone=$_POST['telephone']; $company=$_POST['company']; $address=$_POST['address']; $address_a=$_POST['address_a']; $address_b=$_POST['address_b']; $address_c=$_POST['address_c']; $town=$_POST['town']; $city=$_POST['city']; $postal_zip_code=$_POST['postal_zip_code']; $state=$_POST['state']; $country=$_POST['country']; $product_of_interest=$_POST['product_of_interest']; $comments=$_POST['comments']; if (!$first_name) { echo 'dick head you have forgotton something'; exit; } if (!get_magic_quotes_gpc()) { $first_name = addslashes($first_name); $last_name = addslashes($last_name); $email = addslashes($email); $telephone= addslashes($telephone); $company= addslashes($company); $address= addslashes($address); $address_a= addslashes($address_a); $address_b= addslashes($address_b); $address_c= addslashes($address_c); $town= addslashes($town); $city= addslashes($city); $postal_zip_code= addslashes($postal_zip_code); $state= addslashes($state); $country= addslashes($country); $product_of_interest= addslashes($product_of_interest); $comments= addslashes($comments); } @ $db = new mysqli('localhost', 'root', 'xx', 'xx'); if (mysqli_connect_errno()) { echo 'error'; exit; } $query = " INSERT INTO enquiries (first_name, last_name, email, telephone, company, address, address_a, address_b, address_c, town, city, postal_zip_code, state, country, product_of_interest, comments ) VALUES ('".$first_name."', '".$last_name."', '".$email."', '".$telephone."', '".$company."', '".$address."', '".$address_a."', '".$address_b."', '".$address_c."', '".$town."', '".$city."', '".$postal_zip_code."', '".$state."', '".$country."', '".$product_of_interest."', '".$comments."')"; $result = $db->query($query); if ($result) echo $db->affected_rows. 'enquiry entered'; $db->close(); ?> kind regards Dazzclub
  21. after reading your post charlieholder, i thought i`d make myself some coffee have a break and look at it with fresh eyes. And behold, those fresh eyes started to work. i looked closer at my script and had noticed i spelt slashes incorrectly and also forgot the "$" aswell, getting somewhere i thought. SO i then removed all the input fields leaving just the first name along with correcting the php script, all is fine. so what i am doing now is building and testing the form as i go along, so far so good. cheers for your help guys. kind regards Dazzclub
  22. aa, i see why you thought that affordit, i have just changed the script along with the form and it still stops at "echo 'dick head you have forgottom something'; I have a coffee and come back to this. Cheers guys kind regards Dazzclub
  23. Hi people i have a contact form on my site, the the users fill in and then there is a php script that inserts the data into the write table. currently it is not working and i have been at it for over an hour and my eyes are hurting.. here us my html form --------------------- <form method="post" action="enquiry.php"> <ul class="contactForm"> <li>First name: <input type="text" name="first_name"></li> <li>Last name: <input type="text" name="last_name"></li> <li>Email: <input type="text" name="email"></li> <li>Tel: <input type="text" name="telephone"></li> <li> </li> <li>Company: <input type="text" name="company"></li> <li>Address: <input type="text" name="address"></li> <li>Address 1: <input type="text" name="address_a"></li> <li>Address 2: <input type="text" name="address_b"></li> <li>Address 3: <input type="text" name="address_c"></li> <li>Town: <input type="text" name="town"></li> <li>City: <input type="text" name="city"></li> <li>Post / Zip code: <input type="text" name="post_zip_code"></li> <li>State Province: <select name="state"> <option value="Select One" selected="selected">Select One</option> <option value="AB">AB</option> <option value="WY">WY</option> </select> </li> <li>Country: <select name="country" > <option>Select a country</option> <option>Australia</option> <option>UK</option> </select> </li> <li> </li> <li>Product of interest: <select name="product_of_interest"> <option value="Select One" selected="selected">Select One</option> <option>Game Cards and Stickers</option> <option>Beer Mats and Coasters</option> <option>Thermometers</option> <option>Stirrers</option> <option>Glassware</option> <option>P.O.S</option> <option>Labels and Packaging</option> </select> </li> <li>comments:<br /> <input type="text" name="comments" style="height:134px; width:220px;"></li> <li><input type="submit" name="submit" value="submit" title="Click here to search"></li> </ul> </form> --------------------- and here is my php script ----------------------- <?php require_once("includes/connection.php"); ?> <?php $first_name=$_POST['first_name']; $last_name=$_POST['last_name']; $email=$_POST['email']; $telephone=$_POST['telephone']; $address=$_POST['address']; $address_a=$_POST['address_a']; $address_b=$_POST['address_b']; $address_c=$_POST['address_c']; $town=$_POST['town']; $post_zip_code=$_POST['post_zip_code']; $city=$_POST['city']; $state=$_POST['state']; $country=$_POST['country']; $product_of_interest=$_POST['product_of_interest']; $comments=$_POST['comments']; if (!$first_name || !$last_name || !$email || !$telephone || !$address || !$address_a || !$address_b || !$address_c || !$town || !$post_zip_code || !$city || $state || $country || $product_of_interest || $comments) { echo 'dick head you have forgotton something'; exit; } if (!get_magic_quotes_gpc()) { $first_name = addslahes(first_name); $last_name = addslahes(last_name); $email = addslahes(email); $telephone = addslahes(telephone); $address = addslahes(address); $address_a = addslahes(address_a); $address_b = addslahes(address_b); $address_c = addslahes(address_c); $town = addslahes(town); $post_zip_code = addslahes(post_zip_code); $city = addslahes(city); $state = addslahes(state); $country = addslahes(country); $product_of_interest = addslahes(product_of_interest); $comments = addslahes(comments); } @ $db = new mysqli('localhost', 'root', 'xx', 'xxx'); if (mysqli_connect_errno()) { echo 'error'; exit; } $query = "INSERT INTO enquiries (first_name, last_name, email, telephone, company, address, address_a, address_b, address_c, town, city, post_zip_code, state, country, product_of_interest, comments) VALUES ('".$first_name."', '".$last_name."', '".$email."', '".$telephone."', '".$address."', '".$address_a."', '".$address_b."', '".$address_c."', '".$town."', '".$post_zip_code."', '".$city."', '".$state."', '".$country."', '".$product_of_interest."', '".$comments."')"; $result = $db->query($query); if ($result) echo $db->affected_rows. 'enquiry entered'; $db->close(); ?> ----------------------- I have managed to see where it stops working, i put an echo displaying 'dick head you have forgotton something', which currently it shows every time i press submit. any help would be great. kind regards Dazzclub
  24. Hi, I have managed to sort it out. I had to change case-studies.php a bit. Originaly i had used lower case id like this if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { //correctly accessed $id=$_GET['id']; } else { I then chose to change them to UPPERCASE like this if ( (isset($_GET['ID'])) && (is_numeric($_GET['ID'])) ) { //correctly accessed $id=$_GET['ID']; } else { .... I then had to change my query from $sql = "SELECT * FROM case_studies WHERE id = $id"; to $sql = "SELECT * FROM case_studies WHERE ID = $id"; And it now works. Below is my working script <?php if ( (isset($_GET['ID'])) && (is_numeric($_GET['ID'])) ) { //correctly accessed $id=$_GET['ID']; } else { $errors[] = 'You have accessed this page incorrectly.'; } { $sql = "SELECT * FROM case_studies WHERE ID = $id"; If ($r = mysqli_query ($connection, $sql)) { //sending the query to the mySQL server While ($row = mysqli_fetch_array($r)) { //inputs the data into the table $id = $row['ID']; $case_title = $row['case_title']; $content = $row['content']; $download = $row['download']; $image = $row['image']; } } } ?> Thanks for all your help. kind regards Dazzclub
  25. Hi, I have done that, also some tweaking. When you now press one of the case study links it goes the case-studies.php page (orginally it didnt even show) and now displays some content from the correct table (within the case_studies table). But when i press any of ther other links the content doesnt change. hmmm, i'll do more research on this. kind regards
×
×
  • 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.