Jump to content

PHP dropdown and iframe help. Willing to donate for assistance. ;)


daniel_son

Recommended Posts

Hi all, beginner here.  ::)

 

I'm have a single page with a PHP dropdown which lists phone names from my database and an iframe on the same page. Im trying to pass the value (Phone_Make and Phone_Model) from what is selected to the dropdown to an iframe url which is called below.

 

So when someone selects a certain mobile name from the dropdown, the iframe gets loaded with that value in its URL.

 

With a bit of googling I've managed to get the phone drop working but thats as far as I've got.

 

I'm sure this is straight forward to most coders. Willing to send someone a small thankyou payment (for a beer/coffee) if they can provide me with the needed code to get this working. I was also wondering if this should be approached with javascript not php.

 

Many thanks in advance.

 

J ;)

 

<html>
<body>

<?php
ini_set('display_errors',1); 
$dbh = mysql_connect("localhost", "DB_USER", "DB_PASSWORD");
mysql_select_db("DB_NAME");
// Write out our query.
$query = "SELECT CONCAT(Phone_Make, ' ', Phone_Model AS Full_Phone_Name FROM Mobile_DB_table ORDER BY Full_Phone_Name";
// Execute it, or return the error message if there's a problem.
$result = mysql_query($query) or die(mysql_error());
$dropdown = "<select name='Mobile_DB_table'>";
while($row = mysql_fetch_assoc($result)) {
$dropdown .= "\r\n<option value='{$row['Full_Phone_Name']}'>{$row['Full_Phone_Name']}</option>";
}
$dropdown .= "\r\n</select>";
echo $dropdown;
?>

<iframe src='http://www.somedomain.com/iframe.php?make=INSERT_MAKE_HERE&model=INSERT_MODEL_HERE'  style='width:100%; height: 1000px' scrolling='auto' frameborder='0' ></iframe>

</body>
</html>

Link to comment
Share on other sites

Thanks, I actually looked at that earlier today. Im afraid Im far from a coder so couldn't make sense of it. I really need someone to provide the code for me.

 

Happy to donate to somebody if they could knock this functionality up for me. (Dropdown list of phone names, where the iframe underneath loads according to the item in the list they select)

 

I need to start making attempts to network with new php devs as the guy I normally use is unavailable.

 

Hope someone can help with this, thanks

 

J ;)

 

 

 

 

Link to comment
Share on other sites

Can you please post the contents of iframe.php, also a link to view in the browser would be useful but not essential.

 

The code you have posted has a drop down, but no 'submit' button to click and update the iframe.  You can either include a submit button or use javascript to automatically detect when the drop down changes and reload the iframe.

 

If you can show us the code iframe.php and give us a link to the page you are trying to change this should be pretty easy to solve.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.