473,396 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using a selection from a drop down menu

I am creating a RSS feed display. I need to be able to select a number from a drop down box and use it to display that number of feeds.
I guess i am unsure of where to put the requested tag.


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $site_err = NULL;
  3. $my_num = 25; //sets num to 25 by default
  4. $num = NULL;
  5. ?>
  6.  
  7. <form method="post" action="feed_rss.php">
  8.     <label for="site">URL:</label>
  9.     <input type="text" name="site" id="site" />
  10.     <?php
  11.     if($site_err != NULL){
  12.         echo "<span class = \"error\">$site_err</span>";
  13.     }
  14.     ?>
  15.     <br />
  16.  
  17.  
  18.     <label for='num'>Num of Feeds:</label>
  19.     <select name='num'>
  20.         <option value="1">1</option>
  21.         <option value="2">2</option>
  22.         <option value="3">3</option>
  23.         <option value="4">4</option>
  24.         <option value="5">5</option>
  25.         <option value="6">6</option>
  26.         <option value="7">7</option>
  27.         <option value="8">8</option>
  28.         <option value="9">9</option>
  29.         <option value="10">10</option>
  30.         <option value="11">11</option>
  31.         <option value="12">12</option>
  32.         <option value="13">13</option>
  33.         <option value="14">14</option>
  34.         <option value="15">15</option>
  35.         <option value="16">16</option>
  36.         <option value="17">17</option>
  37.         <option value="18">18</option>
  38.         <option value="19">19</option>
  39.         <option value="20">20</option>
  40.         <option value="21">21</option>
  41.         <option value="22">22</option>
  42.         <option value="23">23</option>
  43.         <option value="24">24</option>
  44.         <option value="25">25</option>
  45.     </select>
  46.     <br />
  47.  
  48.     <label for="sort">Sort:</label>
  49.     <select name="sort">
  50.         <option value="Ascending">Ascending</option>
  51.         <option value="Descending">Descending</option>
  52.         <option value="Random">Random</option>
  53.  
  54.     </select>
  55.     <br />
  56.  
  57.     <input type="submit" name="submit" value="Submit" class="submit-button" />
  58. </form>
  59.  
  60. <!--Logic    -->
  61.  
  62.  
  63. <!--http://www.engadget.com/rss.xml-->
  64. <?php
  65. $rss = simplexml_load_file($_POST['site']);
  66. ?>
  67.  
  68. <h1><?php echo $rss->channel->title; ?></h1>
  69. <ul>
  70.  
  71. <?php
  72.     $variable=$_REQUEST['num'];
  73.     for ($x = 0; $x < $variable; $x++)
  74.         foreach($rss->channel->item as $chan) {
  75.             echo "<li><a href=\"".$chan->link."\">";
  76.             echo $chan->title;
  77.             echo "</a></li>\n";
  78.             }
  79.  
  80. ?>
Mar 5 '13 #1
3 1278
Rabbit
12,516 Expert Mod 8TB
I don't know what you mean when you say "where to put the requested tag". Define tag. What tag are you talking about? What line of code are you referencing?
Mar 5 '13 #2
I switched it up a bit to use an input box instead of a drop down. But i need to print the number of rss feeds from an inserted url based on the number they enter into the text box if that makes sense. I think I was more or less talking about line 72, but after doing a little more editing, i'm not sure that is what i needed to use. I have ended up using $_POST and I think i have figured it out myself. but thanks for the reply
Mar 5 '13 #3
Rabbit
12,516 Expert Mod 8TB
Please post your solution so that if someone else has the same problem, they can benefit from your solution.
Mar 5 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Yve | last post by:
Hello, I am new here and received good advice many times before by just reading - now I would like to ask this question: I have got a frameset of 5 frames: navigation and 4 content-frames. How...
6
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens...
1
by: Greg Scharlemann | last post by:
I would like to automatically populate a drop down menu when the page loads based on the selection of an item in a different drop down menu. I made a test page that when drop down #1 changes, drop...
11
by: Dan | last post by:
Hello all, I am getting records from a db and displaying the records to the user through a drop down menu in an asp page. Each record has 6 fields and I need to display them all to the user in...
1
by: StevePBurgess | last post by:
Hi I am using a drop down menu adapted from the one in Stylin with CSS by Charles Wyke Smith. The CSS is below. It works perfectly in Internet Explorer (using the csshover behaviour file) but...
2
by: ponyeyes | last post by:
Hi There, I am a bit of a newbie to PHP programming and I would like to know how I can place a selected drop down option into a PHP variable and then produce an sql query which incorporates this...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
4
by: cctxman1942 | last post by:
Here is what I have done: Created a page with a drop down menu listing names of builders retrieved from a mysql database containing contact info for client builders. What I need to do, and so far...
4
by: magmike | last post by:
I've got a control on my form that allows the user to select a record based on a form field (in this example, the drop down menu shows the company name, followed by the contact name but uses the...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.