Okay so a part of the web page that I'm currently building on Dreamweaver CS4 requires this: (Its for grocery items in a supermarket)
- Visitor types item name into开发者_开发技巧 a textfield, hits the submit button.
- The html page for that specific item will be displayed inside an IFrame below. The html page names however are named in their respective item ID's 1B45.html, 1002.html etc
- Each item has a 4 character ID such as 123A or 0002 etc. I have a table with two columns: ID and item name, I'm not really sure how to do the conversions.
I guess that is simple enough, here is the coding I have for this part so far:
<input type="text" name="textfield2" id="textfield2" />
<input type="submit" name="button2" id="button2" value="Search" />
<iframe frameborder="1" width="100%">
</iframe>
Can anyone direct me on what to do next?
I'll probably place the 500 or so item html pages in the same folder as this one (index.html).
I think thats as simple as I can put it, thanks for your time :D
You will need a database. You will use PHP and MySQL. You will not have 500 separate pages. You will have one page that gives you the query results, depending on the particular query.
I don't mean to make you feel crappy, I understand you're probably fairly new to all of this.
I think you're going about the project all wrong. Running a database is a far more efficient and lower workload way of doing this. IFrames and hundreds of HTML pages is going to be far more work than the tradeoff. Especially if you are charging $ by the hour.
I'd love to help lend what advice I can and even get you pointed in the right direction of DB work. To be honest, my first CMS used flat files as the database back when I was first learning... and even something like that will lower your work load (my second iteration of my cms was using MS Access, and now I use Sql Server exclusively). If you're willing to take the time to learn it all, it's not that difficult to wrap your head around the basics.
Don't listen to people who point you in a single technology direction, but work with what you're comfortable with. PHP, ASP, ASP.NET RUBY.. all of these will give you the tools you need to get started. For a project like this, it simply boils down to preference.
To give you a brief idea of how simple this "could" be, think about this
- 1 Database with 1 Table for all of your supermarket items
- 1 page to display a single item and all of it's details
- 1 page to display a list of all the items (paged results are nice too but are a little harder to code)
- then the rest of your website as per usual.
It seems like the current answers are "you're doing it wrong" and I kind of agree. But I figured I'd take a stab at showing you exactly how to "do it wrong".
My solution is to use javascript to set the location of the IFrame to the text within your textbox. I haven't tested it and I'm not very good at javascript, but it might give you an idea where to start.
In the head:
<script type="text/javascript">
function convert(){
var itemId = document.getElementById('textfield2').value;
document.getElementById('theframe').src = itemId + ".html";
}
</script>
in the body:
<input type="text" name="textfield2" id="textfield2" />
<input type="submit" name="button2" id="button2" value="Search" onclick="convert();" />
<iframe id="theframe" frameborder="1" width="100%">
</iframe>
精彩评论