Jump to content

rec0il

Members
  • Posts

    19
  • Joined

  • Last visited

rec0il's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I'm trying to create a code that can help me and my friend keep track on how much weight we have used in past workouts and update it regularly while at the gym. To visualise what I'm trying to create, here is a link to the design. Click me I'm not very good at php coder nor SQL, so it's pretty difficult for me, but I've tried to create the code for the whole design but I'm stuck and can't figure out how to create the rest, I was hoping someone could help me. What I'm trying to achieve; To have the name of whoever using it at the top. To have the dropdown menu automaticly generated from my database To have it show the current weight on the selected exercise Be able to update the weight fast and easy What I have so far is <?php include ("connect.php"); $sql = "SELECT * FROM `workout` WHERE exercise='dumbell bench press'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "<br> Ali: ". $row["Ali"] . "<br> Emil: ". $row["Emil"] . "<br><br>" ; } } else { echo "0 results"; } function updater($value,$id){ include ("connect.php"); $value=mysqli_real_escape_string($conn,$value); $id=mysqli_real_escape_string($conn,$id); $sql = "UPDATE `workout` SET Ali='{$value}' WHERE exercise='{$id}'"; if ($conn->query($sql) === TRUE) { header("Refresh:0"); } else { echo "Error updating record: " . $conn->error; } $conn->close(); } if (isset($_POST['Ali'])) updater($_POST['Ali'],$_POST['id']) ?> <html> <body> <?php include ("connect.php"); $sql = "SELECT exercise FROM `workout`"; $result = $conn->query($sql); if ($result->num_rows > 0) { $select= '<select name="select">'; // output data of each row while($row = $result->fetch_assoc()) { $select.='<option value="'.$row['exercise'].'">'.$row['exercise'].'</option>'; } } else { echo "rest in peace"; } $select.='</select>'; echo $select; ?> <br><br> <form action="" method="post" style="height:50px;width:50px;"> <input type="hidden" name="id" value="dumbell bench press" /> <input type="text" name="Ali" /><br><br> <input type="submit" /><br/> </form> </body> </html> Where I've created my database like so: http://i1227.photobucket.com/albums/ee433/rec0ill/12312321_zpsbkamhfry.png
  2. Had it in my mind, but would it be possible to make the area of my map tag, highlight on mouseover too? Can't really seem to get it working this way
  3. Hi again PHP Freaks. So I would like to code something similar to the buy menu of Counter-strike: Global offensive in-game module, just in a browser and for a project of mine. I've made the design in photoshop to illustrate better. I just don't know what I should look into to make this kind of menu, I would love if someone could explain me what languages that this would require. (I'm guessing HTML, CSS and jQuery but I am not sure) more specific help like which particular codes would be much appreciated. Here is a picture of what I would like to create. (Also attached) http://i1227.photobucket.com/albums/ee433/rec0ill/CSGOKeyz_zps4195288a.png
  4. Yeah I see.. Hoped not to get JS involved as I'm not very familiar with it. Is there by any chance you may direct me to a website in which I can read more about the code I would need to know in order to make one of these work? Or perhaps if you could explain it somehow I would be very grateful. Thx in advance - rec0il
  5. Oh didn't know that, but unfortunately my quantity box is inside another form tag haha, so that probably won't work.. Any other tips? Also would it be more helpful if i were to post my code?
  6. Regarding the easiest solution: That's unfortunately not what I want. I want my paypal button on the bottom of my page and the quantity box at almost the top of the page. So that would screw it up, if i had to make everything between them inside the form tag as well hehe - or am i wrong? I haven't really been able to find something on google, can you maybe point me in the right direction regarding the coding for the more complexity solution?
  7. Hello Codingforums, yet again I desire some help to my coding, this time regarding a paypal button. I'm working on a local project of mine in which I wish to let my costumers type the amount of quantities for a product they wish into a text box and then want it to automatically edit the amount of quantities on the paypal page. This works when I have the input inside the form, but due to my template I wish to have my quantity text box outside the "form" code of the paypal button but still want it to connect so that it changes. Let me explain with some code This is the working code for which i can enter the amount of quantities into a text box and it will automatically change it on the paypal page as well. <div id="payment" style="margin-top:10px;"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="TEXT" name="quantity" value="1"> <input type="hidden" name="hosted_button_id" value="C5P9LBML2FSC6"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/da_DK/i/scr/pixel.gif" width="1" height="1"> </form> </div> This is what I want it to do, I want to be able to put the input of the quantities text box onto another div and still be able to change the amount of quantities on paypal. (Doesn't change the amount of quantities when clicked on button) <div id="anotherdiv"> <input type="TEXT" name="quantity" value="1"> </div> <div id="payment" style="margin-top:10px;"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="C5P9LBML2FSC6"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/da_DK/i/scr/pixel.gif" width="1" height="1"> </form> </div> Thx in advance - rec0il
  8. I'm not very familiar with jQuery, could you direct me in the right direction maybe? Thank you I'm not sure what part of the code you would need, but heres the full of the part I'm working on. <div class="part2"> <img src="images/part2.png"><br> <input type="number" style="text-align:center;width:100px;background-color:transparent;color:#fff;border:0px;" name="quantity" value="1"><br> <table style="width:300px;margin-left: auto;margin-right:auto;margin-top:10px;"> <tr> <td> Total price: </td> <td> 1.2€ </td> <td style="font-size:12px;color:#e07b14"> 1.2€ Each </td> </tr> </table> <table style="width:380px;margin-left: auto;margin-right:auto;margin-top:10px;"> <tr> <td style="width:52%;"> Redeeem discount code: </td> <td style=""> <input style="text-align:center;" type="text"> </td> </tr> </table> </div> I've tried adding $quantity = (int)$_POST['quantity']; instead the previous code "$quantity = 10;" but it didn't seem to be working and my input name is set to quantity. I must have misunderstood something
  9. Thanks for the great and fast answer fastsol, really appreciated. Though I'm not sure if I can use this to function as I want it to. I would like it to automatically change the total price every time the quantity value is changed in the input, so that it doesnt have to depend on a given value. Heres the HTML code of my input. <input type="number" name="quantity" value="1"> So I would like the php code to take the value from the input and put it in where it says X $quantity = X; How would this be possible?
  10. Hi again PHPFreaks I'm building on my new local project in which I wish to create a working function for a future e-commerce. But I ran into a problem. Please open following picture in order for me to illustrate my problem. http://i1227.photobucket.com/albums/ee433/rec0ill/example_zpsacd52b0c.jpg The picture represents what I want. My only problem is that I have no idea how to make the "Total price:" value (which is 1.2€ on the picture) to match the quantities above. Lets say a costumer chose 10 quantities - in that case i would like it to automaticly change the total price value to 12€ instead, so that it matches the amount of quantities chosen. How would i be able to do this? Thx in advance - r e c 0 i l
  11. I'm not very familiar with jQuery, is it really necessary to use it? Can't it be done in php/html only? and Is there anything specific you could recommend to look into, other than Ajax?
  12. Hi again PhpFreaks, yet again I got a problem regarding coding. I want to build somewhat a score board, which shows the latest results of matches. I've build it so that it shows all the matches on my MySQL. $query = $pdo->prepare("SELECT * FROM results ORDER BY id DESC"); But i would like an option for my readers to choose a specific team, so that only matches of this specific team is shown. How would i be able to implement this feature without having to create a new page and stay on the same? Code of HTML <div class="results"> <table style="width:800px"> <?php foreach ($results as $result) { ?> <tr> <td style="background-color:grey;"><?php echo $result['date'] ?></td> <td ><?php echo $result['team1'] ?></td> <td style="background-color:green;"><?php echo $result['result1'] ?></td> <td><?php echo $result['team2'] ?></td> <td style="background-color:red;"><?php echo $result['result2'] ?></td> <td style="opacity: 0.5;"><?php echo $result['league'] ?></td> </tr> <?php } ?> </table> </div> Examples is more appreciated that explanations, I'm not that familiar with the english terms so makes it alittle harder for me to understand. Thanks alot in advance
  13. Yeah not sure why I didn't do that. I've updated it and everything works great now. Still got issues with the 3rd one though. Hope to see someone smart who can help me out.
  14. Wow, thanks for the quick answer Ch0cu3r. Both issues are now fixed and will be uploaded on the online website soon. Thanks alot
  15. Hi again PhpFreakz, yet again I have some issues with my PHP part of my website. A brief summary, I've created an simple CMS for my website so that I am able to add news and results faster and easier. The CMS works great I just have some issues with the finalizing part, so that it also works and looks good with my website. I have in total 3 issues, I will be stating the easiest first and follow up to the hardest. As I'm sure that many people can help me with some of them and might not be able to solve the difficult ones. If you head to this page, you can see my articles I've added to my website. I have an issue with the maximum allowed articles on this page. If I were to add several more articles it would just ignore my design and keep on going. I would like to set a maximum of 4 shown articles, how can i do that? Next up is another fairly easy one. I have - on same page as previous issue - an issue with the articles position. Currently the newest article created is on the bottom, I would like to diverse that so that the top has the newest news and it then goes down to the oldest. My third issue is a fairly complex one (At least for me) and is also an issue on several other pages. If you notice when you click on one of the news in the article page you get redirected to a new page where you can read the full article, problem is that I would like this "new page" to be opened in the same page as where the articles are. For example if you were to change on the navigation, then you get redirected on the same page but only on the "box" that appears. I would like the same effect from when my readers click on one of my articles, they just get a box with the full article and a "go back button". How could i possibly do this? Here are the codes I think are necessary to fix my issues. Let me know if you need anything else and I'll gladly add those. For 1st and 2nd issue: HTML + Some PHP part of index.php <?php foreach ($articles as $article) { ?> <h1 class="newsh1"><a href="article.php?id=<?php echo $article['Id'] ?>"><?php echo $article['title'] ?></a></h1> <p class="newstext"> <?php echo $article[ 'short'] ?> </p> <p class="newsby">Artikel skrevet af <a class="newsauthor" href="#!/page_More"> <?php echo $article[ 'author'] ?> </a>| <span class="newsdate"><?php echo date('j. F o', $article['date']); ?></span> </p> <div class="table"></div> <?php } ?> For 3rd issue: Full code of article.php <?php include_once( 'includes/connection.php'); include_once( 'includes/articles.php'); $article=new Article; if (isset($_GET['id'])) { $id = $_GET['id']; $data = $article->fetch_data($id); ?> <html> <head> <title>CMS System</title> <link rel="stylesheet" href="css/cms.css" /> </head> <body> <div class="container"> <h3><?php echo $data['title'] ?></h3> <small class="margin-left:20px;">Skrevet af <?php echo $data['author'] ?> den <?php echo date('j. F o', $data['date']); ?></small> <p> <?php echo $data[ 'body'] ?> </p> <a href="index.php">← Back</a> </div> </body> </html> <?php } else { header('Location: index.php'); exit(); } ?> HTML+PHP part on index.php <li id="Nyheder"> <div class="box1"> <div class="inner"> <a href="#" class="close" data-type="close"><span></span></a> <div class="news"> <h2>Senest nyt - Side 1</h2> <?php foreach ($articles as $article) { ?> <h1 class="newsh1"><a href="article.php?id=<?php echo $article['Id'] ?>"><?php echo $article['title'] ?></a></h1> <p class="newstext"> <?php echo $article[ 'short'] ?> </p> <p class="newsby">Artikel skrevet af <a class="newsauthor" href="#!/page_More"> <?php echo $article[ 'author'] ?> </a>| <span class="newsdate"><?php echo date('j. F o', $article['date']); ?></span> </p> <div class="table"></div> <?php } ?> </div> <div class="oldernews"><span class="newsold"><a href="#!/Nyheder_page2"><strong>Ældre artikler ></strong></a></span></span> </div> </div> </div> </li>
×
×
  • 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.