Jump to content

How would I do this?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
8 replies to this topic

#1
Predatorftw

Predatorftw

    Newbie

  • Members
  • Pip
  • 5 posts
Hello. I do not need any direct programming code, more like guidelines to complete a site that I wish to create. I've layouted it here below for you:
http://i39.tinypic.com/femot4.jpg

The point of the picture is that, once the I check another option on for example chassis, the chassi option on the right would update to that option, but also the price would reflect, also the information text, and the picture. I'm thinking something like this in a config file:
1.1.image = "linktopic";
1.1.text = "bla bla bla";
1.1.price = "400";

I'm just wondering how I could make the option on the -> side update once I change my option, but also the text, info. I also need this to be saved somewhere, in a cookie or something maybe would be the smartest thing, as the information needs to be stored once you press order which will appear soon, and therefore, we need to see what they've ordered. In other words, the product options must be saved in a cookie.

I'm not asking someone to my job, I'm just asking for a guide, directions, or a library that I can work with.

Thanks!

#2
Furry Pancake

Furry Pancake

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
You can definitely use Javascript to update the side once you click an option,

OR

I have setup a page on my website which allows the user to select an account to transfer money to, once the radio box is checked, the form automatically updates from accounts.php to accounts.php?action=account. The form I used will use the POST method to post the needed information to the next "account" page.. if that makes sense.
Durr dah dur.

#3
Predatorftw

Predatorftw

    Newbie

  • Members
  • Pip
  • 5 posts

Furry Pancake said:

You can definitely use Javascript to update the side once you click an option,

OR

I have setup a page on my website which allows the user to select an account to transfer money to, once the radio box is checked, the form automatically updates from accounts.php to accounts.php?action=account. The form I used will use the POST method to post the needed information to the next "account" page.. if that makes sense.

Thank you for your response. Great! How do you think I should continue? Are there any scripts I can look into and make something similar of?

#4
Furry Pancake

Furry Pancake

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
If you would like, I can help you out with this. I'm not sure if there is anything online (there always is, but not sure where).. but I have quite a few pages that use this. Give me a few mins and I will write you up an example script.
Durr dah dur.

#5
Predatorftw

Predatorftw

    Newbie

  • Members
  • Pip
  • 5 posts

Furry Pancake said:

If you would like, I can help you out with this. I'm not sure if there is anything online (there always is, but not sure where).. but I have quite a few pages that use this. Give me a few mins and I will write you up an example script.

I'd appreciate this indescribably. If you have an instant messager, please PM it to me. Else, I'll wait for your updates. Thanks a bunch Furry!

#6
Furry Pancake

Furry Pancake

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
Alright, so you need to create a script that will pull the information from a database that you have.

I had created a MySQL table called computerinfo with the following categories: ID, name, processor, processor_fan, video_card, memory, hdd, etc...

Once I did that, I will need to create my table that will select the list of chassis from the db.
For example, I am will create a function to pull the chassis information from the "computerinfo" table:
<table width="700">
        <tr>
                <td width="40%"><table width=100%><form name=transferto method=post action=?page=list><?php chassisList(); ?><tr><td><input type="submit" value="Select"></input></td></tr></table></td>
    </tr>
    <?php if ($page == "list") { $id = $_POST['id']; echo "<tr><td width=60%>"; chassisInfo($id); echo "</td></tr>"; ?>
</table>
function chassisList() {
        $query = "SELECT * FROM computerinfo'";
        $result = mysql_query($query) or die(mysql_error());
        while($row = mysql_fetch_array($result)){
                echo "<tr><td width=50%><input type=radio name=chassisValue value={$row['name']}></td></tr>";
    }
}
function chassisInfo($id) {
        $query = "SELECT * FROM computerinfo WHERE id='$id'";
        $result = mysql_query($query) or die(mysql_error());
        while($row = mysql_fetch_array($result)){
                echo "
<table width=100%>
    <tr>
        <td width=25%>Name:</td>
        <td width=75%>{$row['name']}</td>
    </tr>
    <tr>
        <td width=25%>Processor:</td>
        <td width=75%>{$row['processor']}</td>
    </tr>
</table>
";
    }
}
Keep in mind that this is just a sample script, but it's how you would be able to do it :)
Durr dah dur.

#7
Predatorftw

Predatorftw

    Newbie

  • Members
  • Pip
  • 5 posts

Furry Pancake said:

Alright, so you need to create a script that will pull the information from a database that you have.

I had created a MySQL table called computerinfo with the following categories: ID, name, processor, processor_fan, video_card, memory, hdd, etc...

Once I did that, I will need to create my table that will select the list of chassis from the db.
For example, I am will create a function to pull the chassis information from the "computerinfo" table:
<table width="700">
        <tr>
                <td width="40%"><table width=100%><form name=transferto method=post action=?page=list><?php chassisList(); ?><tr><td><input type="submit" value="Select"></input></td></tr></table></td>
    </tr>
    <?php if ($page == "list") { $id = $_POST['id']; echo "<tr><td width=60%>"; chassisInfo($id); echo "</td></tr>"; ?>
</table>
function chassisList() {
        $query = "SELECT * FROM computerinfo'";
        $result = mysql_query($query) or die(mysql_error());
        while($row = mysql_fetch_array($result)){
                echo "<tr><td width=50%><input type=radio name=chassisValue value={$row['name']}></td></tr>";
    }
}
function chassisInfo($id) {
        $query = "SELECT * FROM computerinfo WHERE id='$id'";
        $result = mysql_query($query) or die(mysql_error());
        while($row = mysql_fetch_array($result)){
                echo "
<table width=100%>
    <tr>
        <td width=25%>Name:</td>
        <td width=75%>{$row['name']}</td>
    </tr>
    <tr>
        <td width=25%>Processor:</td>
        <td width=75%>{$row['processor']}</td>
    </tr>
</table>
";
    }
}
Keep in mind that this is just a sample script, but it's how you would be able to do it :)

Thanks, but this is niot really what I'm looking for. This still refreshes the page in question.

#8
Furry Pancake

Furry Pancake

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
Maybe use iframes?
Durr dah dur.

#9
webcodez

webcodez

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Rather use divs in combination with AJAX if I got it right what you'd like to do. All you'd need to do is call a javascript/ajax function upon changing the option selected ( like: <select onChange='updateInfo(this.value)'> then the option selected will be passed to the function ) and based on the option selected value the function will display info inside the div ( document.getElementById('myDivId').innerHTML = 'Info for option' ).

Not quite sure if this is what you'd like to do, if so, let me know if you need help =].