Hot answers tagged

7

Give your select a name, and your options a value each. <select class="form-control" id="rating" name="rating"> <option value="5">5</option> <option value="4">4</option> <option value="3" selected>3</option> <option value="2">2</option> <option value="1">1</option> </...


4

what exactly a markup language is and how it is different from programming language and scripting languages in layman's terms, a markup language is a set of markup tags. according to this: A markup language is a set of tags and/or a set of rules for creating tags that can be embedded in digital text to provide additional information about the text ...


3

Thats Really simple, in Google Chrome, simply right click on the page(if your'e using a mac, its cmd-click) without selecting any text, and you shall see a menu bar, like the one in the photo below- Here, click "View Page Source" to see it. Happy Coding!


3

You can achieve that using JavaScript: <div> <h1>SELECT A TOPIC</h1> <select id="select"> <option value="physics">physics</option> <option value="maths">maths</option> <option value="chemistry">chemistry</option> </select> <button type="button" id="submit" style="font-...


3

shift-reload or ctrl-F5 will clear the browser's cache and (should) reload your css file.


2

First, for closed tags, if you open a tag, you should close it. I see you're not closing the <select> tag. More information about that tag maybe found here. Also, you have </div> within the body of your for each loop which means </div> will be there n times where n is the number of iterations that this loop will iterate. Next, you probably ...


2

I just figured it out! The reload was due to the very nature of onsubmit. When I changed it to onClick, I had no issues!


2

The render() function takes two arguments, the first is a string that indicates the name of the template, and the second is an array of key-value pairs. In this case "positions" is a string that represents the key and $positions is the value. Note that the value can be any kind of type, an integer, float, string, etc... or in this case is another array. ...


2

That is the mode required to access a file with apache50 server. You will need to chmod 644 the html file, or any file, to get rid of the "403 Forbidden" error.


2

Flask is doing what you told it to do. There is a line to return an apology. Instead, do something like return render_template("addcash.html") or whatever your template's name is.


2

Thanks to @DinoCoderSaurus for your help - basically the problem was that I was trying to instantiate a MarkerClusterer for each individual marker that was added to the array. The solution was to delete the line markerCluster = new MarkerClusterer(map, markers, {imagePath: '/static/markers/m'}); from the addMarker() function; and instead have it run once ...


2

To make an I'm feeling lucky button, use this code <input value="I'm Feeling Lucky" aria-label="I'm Feeling Lucky" id="lucky" name="btnI" type="submit" data-ved="0ahUKEwiNm6S0jYLrAhXslnIEHYv2B30QnRsIDg">


1

the share in for share in sharesOwnedis the object itself so when u try to use something like priceNow[share] , it doesnt make sense. if you have a diff pricenow list then u can iterate both list using a function called zip(). It works something like this: {% for share, price in share_price %} <tr>enter code here <td>{{ share....


1

This sql "SELECT symbol, price, name, SUM(shares) AS quanties FROM shares WHERE id=:id" always returns one row. Try it in sqlite3/phpliteadmin. You need a GROUP BY clause . Since you (presumably) want one row per symbol, you would add GROUP BY symbol after the where clause (try that in sqlite3/phpliteadmin to see the difference).


1

It's going straight to the 'else' option because when the page initally loads, it's not actually a 'POST' request. It's a 'GET' request. With GET you are retrieving the .hmtl file to be loaded. So, as the answer above stated, you need to return the template of your html file with the else statement.


1

You have more <tr> than </tr>, and the rowspan elements probably should be in the first row. Maybe you can try something like {% for stock in symbol %} <tr> <td>{{ stock["symbol"] }}</td> <td>{{ stock["shares"] }}</td> <td>{{ stock["quoteprice"] }}</td> <td>{{...


1

The problem is that you are trying to access the list currentprices in quoted.html using a dictionary as the index. You are trying to return the value of the following list element, which obviously does not work: currentprices[{'symbol': 'nflx', 'price': 281.78, 'shares': 2, 'id': 3}] Think about making currentprices into a dictionary so that you can ...


1

VALUES is a reserved word in mysql (full list here); used only in INSERT syntax. CS50::query replaces all '?' with the values sent as arguments. Let's assume id is 1, symbol is X and shares is 20. The sql it is trying to process would be: INSERT INTO portfolios (user_id, symbol, shares) VALUES(1, X, 20) ON DUPLICATE KEY UPDATE shares = shares + ...


1

@DinoCoderSaurus is right. See also 403 Forbidden / permissions / chmod -- the definitive guide on the CS50 Reddit, for details on the minimum required permissions for different types of file. TL;DR: It's 711 for directories (unless you want Apache2 to generate a dynamic index when there is no index.html or index.php provided, then it's 755). It's 644 for ...


1

@CliffB nailed it in the comments. If your css directory is located in the parent directory of my-page, the correct way to use a relative path would be to prepend ../ before your path. This could be repeated as necessary: if the HTML source file is located at example.com/foo/bar/baz/index.html and you want to link to example.com/css/styles.css, you could ...


1

When you call render() in a controller, the function is only executed once and then it exits. No other code in the PHP Controller will execute after the call to render(), so it is not possible for two different render() functions to come into conflict with each other. Let's take a look inside helpers.php at the source for the render() function: /** * ...


1

Since those are the only two tests that fail check50, redirect your attention to how query is built in parse. Since hello.php "works fine", verify that query is properly null-terminated. A helpful format string for printf debugging is "%s<-" so your eye is not fooled by non-printing characters. Where are you printing "Type is:"? I don't think it's ...


1

Q: When should I encrypt passwords? A: Always, and as soon as possible. Whenever a user enters sensitive information like a password, you should immediately encrypt it using a one-way hash function before you do anything at all with it. You should never store a plaintext password in a database, pass it from one PHP file to another, print it, or even store ...


1

Consult this section of the pset specs: http://cdn.cs50.net/2015/fall/psets/7/pset7/pset7.html#styles There are two .css files contained within the pset7/public/css directory that you are free to explore (and modify). Regarding why it is styled the way it is, my suggestion is this: play around with what happens when certain class names are changed or ...


1

Rather than reading a mountain of documentation online, just take a closer look at the distribution code provided by CS50 Staff in the pset7.zip archive. Make sure that you understand the render() function in particular. Pay attention to the way the Controllers (under ~/pset7/public) and the Views (under ~/pset7/views) are implemented. Once you understand ...


1

Ignore this, It was actually fixed very easily by switching the order of the render function and the array loop. Doh!


1

well I have no idea where the problem was but I got rid of it. First, disabling/enabling adapters and adapter settings both within the application and windows really screwed up my connection, had a hard time maintaining a steady connection. I tried reinstalling the VM player thinking maybe it would help with the virtual adapters but I still had a flaky ...


1

The latest version of TextEdit has "smart quotes" turned on by default. Notice your quotes in your screen print? They are "curly quotes" rather than straight quotes. As such, the browser doesn't interpret them correctly when rendering the page. Open TextEdit > Preferences and down near the bottom, un-tick Smart Quotes (and probably Smart Dashes) as well. ...


1

I made something simple but I think you can tinker further on your own: grad.html <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div> <table id="grad1"> <tr> <th>...


1

Why do you have the link for the forgot password in a form group? Also you have a typo and you close the tag instead of opening it (</div class = "form-group"> <a href="forgot-password.php">Forgot Password?</a> </div>). Also what do you mean by footer? The or register for an account apears centered to me. Only the Forgot password ...


Only top voted, non community-wiki answers of a minimum length are eligible