Jump to content

loxfear

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by loxfear

  1. looks pretty easy to use, if it works as i think it does, and it looks a lot less messy as what i did ill try it out
  2. <?php //MySQL Database Connect include 'sqlconnect.php'; $result = mysqli_query($con,"SELECT * FROM aktiviteter"); $i=0; while($row = mysqli_fetch_array($result)) { $id = $row['id']; echo "<script>" "var" . $row['id'] . "= [" "title:" . $row['title'] . ", beskrivelse:" . $row[''] ", pris:" . $row['pris'] . "];" "</script>"" } ?> this is how i would do it, but im not sureif it works, or how to chek if it works :/
  3. edit the code up there to the one that works, so people who end in the same problem are able to make it work
  4. Thanks man! it worked! and i understood why, whitch is even better than just working!
  5. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <?php //MySQL Database Connect include "sqlconnect.php"; echo "<select name='aktivitet' id='aktivitet'>" $sql = mysqli_query($con,"SELECT title FROM aktiviteter"); // check query did not return an error if(!$con) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } while ($row = mysqli_fetch_array($sql)){ echo "<option value=\"owner1\">" . $row['title'] . "</option>"; } echo "</select>" ?> now thats how it looks and php extendtion
  6. "; while ($row = mysqli_fetch_array($sql)) { // NOTE - ALL OF YOUR OPTIONS WILL HAVE THE EXACT SAME VALUE CLAUSE - N.G.!! $options .= ""; } $options .= ""; // NOW begin sending html!!! ?> $options what it gave me
  7. <!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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php //MySQL Database Connect include 'sqlconnect.php'; ?> <select name="aktivitet" id="aktivitet"> <?php $sql = mysqli_query($con,"SELECT title FROM aktiviteter"); // check query did not return an error if(!$sql) trigger_error('DB Error: ' . mysql_error(), E_USER_ERROR); while ($row = mysqli_fetch_array($sql)){ echo "<option value=\"owner1\">" . $row['title'] . "</option>"; } ?> </select> </body> </html> this is how it looks, i cant detect any difference still doesnt work http://polterplanner.dk/bestillere.html thats where it is . dont know if that would help?
  8. thx man, but i have to say, im quite a newbie so im not sure if your push will help me, ill try some stuff and be back
  9. <!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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php //MySQL Database Connect include 'sqlconnect.php'; ?> <select name="aktivitet" id="aktivitet"> <?php //MySQL Database Connect include 'sqlconnect.php'; $sql = mysql_query("SELECT title FROM aktiviteter"); while ($row = mysql_fetch_array($sql)){ echo "<option value=\"owner1\">" . $row['title'] . "</option>"; } ?> </select> </body> </html> why dosnt this work?, if you cant see what i want to happen, ill post an explaination
  10. i think i forgot to tell what i need to know:) i need something to look in to, cos im lost, would i use java for this also or? much appreaciated
  11. hello, im at the moment trying out some stuff and i have given my self this task: i want to be able to select the first row in the tables through a menu. and some of the data in that table into the boxes. and after that be able to get the sum of the selected like if there was prices in there. like in this wireframe i did: (attached)
  12. omg thank you so much .. i will try this tomorrow, even though im sure this works
  13. heres my code: <?php $con=mysqli_connect("______________________"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql = "INSERT INTO aktiviteter (title, firma, beskrivelse, information, pris, rabat, adresse, by, postnummer, telefon, hjemmeside) VALUES ('$_POST[title]','$_POST[firma]','$_POST[beskrivelse]','$_POST[information]','$_POST[pris]','$_POST[rabat]','$_POST[adresse]','$_POST[by]','$_POST[postnummer]','$_POST[telefon]','$_POST[hjemmeside]')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "Thank you for your participation!"; mysqli_close($con); ?> for some reason it tells me that theres an error, and its not the connection to the server :/
  14. so the answer would be, move the email code to the end and remove the first query?
  15. as you can see in my code, the line: $con->query($sql); for some reason gets the info posted on my database twise, and i have no reason why and how to fix this? <?php $con=mysqli_connect(""); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql = "INSERT INTO Persons (Fra, Til, Voksne, Born, Navn, Adresse, Byen, Telefon, Email, Kommentar) VALUES ('$_POST[fra]','$_POST[til]','$_POST[voksne]','$_POST[born]','$_POST[navn]','$_POST[adresse]','$_POST[by]','$_POST[telefon]','$_POST[email]','$_POST[kommentar]')"; { $email = $_POST['email'] ; $subject = $_POST['navn'] ; $navn = $_POST['navn'] ; $adresse = $_POST['adresse'] ; $by = $_POST['by'] ; $telefon = $_POST['telefon'] ; $email = $_POST['email'] ; $fra = $_POST['fra'] ; $til = $_POST['til'] ; $voksne = $_POST['voksne'] ; $born = $_POST['born'] ; $kommentar = $_POST['kommentar'] ; $time = $_SERVER['REQUEST_TIME'];//Onix Time Format $tid = date('d-m-Y H:i:s', $time); $con->query($sql); mail("joachim@loxfear.com","bestilling fra: " . $subject, $navn . "\n" . $adresse . "\n" . $by . "\n" . $telefon . "\n" . $email . "\n\n" . "Fra dato: " . $fra . "\n" . "Til dato: " . $til . "\n" . "Bestilt: " . $tid . "\n\n" . "Antal voksne: " . $voksne . "\n" . "Antal børn: " . $born . "\n\n" . "Bemærkninger: " . $kommentar, "Du har fået en ny Leje Bestilling: "); mail($email,"bestillings bekreftigelse til: " . $subject, $navn . "\n" . $adresse . "\n" . $by . "\n" . $telefon . "\n" . $email . "\n\n" . "Fra dato: " . $fra . "\n" . "Til dato: " . $til . "\n" . "Bestilt: " . $tid . "\n\n" . "Antal voksne: " . $voksne . "\n" . "Antal børn: " . $born . "\n\n" . "Bemærkninger: " . $kommentar, "Denne bestilling blev sendt: " . $con->insert_id); } if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "Din Bestilling er sendt!"; mysqli_close($con); ?>
  16. so ill have to get rid of the auto-increment and use the mysql_insert_id() instead?
  17. im thinking, becaus the id is from an auto-incremented field i cant get the id before it is created, or is that possible? Here is the code i use: im changeing some of it, since i want the email to be in an table, but that doesnt matter since my question is how my id can get into the email $con=mysqli_connect(); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="INSERT INTO Persons (Fra, Til, Voksne, Born, Navn, Adresse, Byen, Telefon, Email, Kommentar) VALUES ('$_POST[fra]','$_POST[til]','$_POST[voksne]','$_POST[born]','$_POST[navn]','$_POST[adresse]','$_POST[by]','$_POST[telefon]','$_POST[email]','$_POST[kommentar]')"; { $email = $_POST['email'] ; $subject = $_POST['navn'] ; $navn = $_POST['navn'] ; $adresse = $_POST['adresse'] ; $by = $_POST['by'] ; $telefon = $_POST['telefon'] ; $email = $_POST['email'] ; $fra = $_POST['fra'] ; $til = $_POST['til'] ; $voksne = $_POST['voksne'] ; $born = $_POST['born'] ; $kommentar = $_POST['kommentar'] ; $time = $_SERVER['REQUEST_TIME'];//Onix Time Format $tid = date('d-m-Y H:i:s', $time); mail("sand@soller.dk","bestilling fra: " . $subject, $navn . "\n" . $adresse . "\n" . $by . "\n" . $telefon . "\n" . $email . "\n\n" . "Fra dato: " . $fra . "\n" . "Til dato: " . $til . "\n" . "Bestilt: " . $tid . "\n\n" . "Antal voksne: " . $voksne . "\n" . "Antal børn: " . $born . "\n\n" . "Bemærkninger: " . $kommentar, "Du har fået en ny Leje Bestilling: "); mail($email,"bestillings bekreftigelse til: " . $subject, $navn . "\n" . $adresse . "\n" . $by . "\n" . $telefon . "\n" . $email . "\n\n" . "Fra dato: " . $fra . "\n" . "Til dato: " . $til . "\n" . "Bestilt: " . $tid . "\n\n" . "Antal voksne: " . $voksne . "\n" . "Antal børn: " . $born . "\n\n" . "Bemærkninger: " . $kommentar, "Denne bestilling blev sendt: "); } if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "Din Bestilling er sendt!"; mysqli_close($con); ?>
  18. hello, i am currently working on a system that sends an email to the person who orders something, in the order, there needs to be an order id. at the moment the id is generated when the information is put into the server. when the form is filled, it submits to the php file, and in that file it sends to the server and in the same time it sends the email, so my problem here is, how do i get that order id into the email,? sorry for the verry unprofessional way i ask this question,
×
×
  • 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.