[PHP] How to take results from search into a html form? menu

Shout-Out

User Tag List

Results 1 to 13 of 13
  1. #1
    Sarcoptes's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [PHP] How to take results from search into a html form?

    Hey,
    I have a fully functional search for a database. When you search for "rör" (yes, swedish..) you get this:

    Now, I want a form just below each of the count.)'s so it would look kind of like this:



    The "ok" button takes you to another php file that puts the values into the database.
    As whole it should work like, you search for a "Vara" like "rör", and get the results, with text boxes beneat heach one of them, with the values presented that you can modify, i.e modify the quantity etc.

    I tried everything I could, but I't simply won't work. Heres a part of the code:
    [PHP] php code - Pastebin.com

    and the php file after that:
    [PHP] otherphpthingy - Pastebin.com

    I imagine the form would be something like this, but how do I implement it so that it shows up on the page?
    [PHP] htmlthingy - Pastebin.com

    I would be very grateful for an answer that solves this.

    Thanks.

    [PHP] How to take results from search into a html form?
  2. #2
    ev1's Avatar Banned
    Reputation
    98
    Join Date
    Nov 2008
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    on your [PHP] php code - Pastebin.com

    put the form inside the mysql_fetch_array - that way it will show up as a form for each of those array items. Just echo it

  3. #3
    Sarcoptes's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply.

    Do you mean it like this?
    [PHP] while ($row = mysql_fetch_array($result echo"<br><form method="post" action= - Pastebin.com
    Still, that doesn't work :/

    I'm still a newb in php :s

  4. #4
    ev1's Avatar Banned
    Reputation
    98
    Join Date
    Nov 2008
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    echo "$count.) &nbsp; 
    		<b>E-Nummer</b>:&nbsp; $title&nbsp;&nbsp;  
    		<b>Vara</b>: $title2&nbsp;&nbsp;  
    		<b>Typ</b>: $title3&nbsp;&nbsp;  
    		<b>Antal i Lager</b>: $title4&nbsp;&nbsp;  
    		<b>Antal i Bil 1</b>: $title5&nbsp;&nbsp;  
    		<b>Antal i Bil 2</b>: $title6&nbsp;&nbsp;<br>
    //throw some <form> code in here, you can add unique value the same way by doing like <form id=\"$title1\"> or whatever you want
    		";
    kinda like that, modify it how you want

  5. #5
    Sarcoptes's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've tried this (I only put one row in the form to make it smaller, just to see if it actually works.):

    Code:
            echo "$count.) &nbsp; 
            <b>E-Nummer</b>:&nbsp; $title&nbsp;&nbsp;  
            <b>Vara</b>: $title2&nbsp;&nbsp;  
            <b>Typ</b>: $title3&nbsp;&nbsp;  
            <b>Antal i Lager</b>: $title4&nbsp;&nbsp;  
            <b>Antal i Bil 1</b>: $title5&nbsp;&nbsp;  
            <b>Antal i Bil 2</b>: $title6&nbsp;&nbsp;<br>
            <br>
            <form method="post" action="elgsdatabas_uppdatera_lager3.php">
            E-Nummer: <input type="text" name="enummer" value="$title" />
            <input  type="submit" name="submit" value="Ok">
            </form>
            "
    and

    Code:
    echo "$count.) &nbsp; 
            <b>E-Nummer</b>:&nbsp; $title&nbsp;&nbsp;  
            <b>Vara</b>: $title2&nbsp;&nbsp;  
            <b>Typ</b>: $title3&nbsp;&nbsp;  
            <b>Antal i Lager</b>: $title4&nbsp;&nbsp;  
            <b>Antal i Bil 1</b>: $title5&nbsp;&nbsp;  
            <b>Antal i Bil 2</b>: $title6&nbsp;&nbsp;<br>
            <br>
            <form method="post" action="elgsdatabas_uppdatera_lager3.php" id="$title">
            E-Nummer: <input type="text" name="enummer" value="$title" />
            <input  type="submit" name="submit" value="Ok">
            </form>
            "
    And a few others, whatever I do, they wont appear on screen.

    Sorry if im bothering you too much D:

  6. #6
    ev1's Avatar Banned
    Reputation
    98
    Join Date
    Nov 2008
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have syntax errors make sure to put a \ before any quote marks in the echo, or else php thinks you're talking about a new variable

    like for exampe:

    Code:
     
    <?
    echo "<form id="test">";
    // this is bad ^^
    echo "<form id=\"test\">";
    // this is good! ^^ 
    ?>
    Last edited by ev1; 06-30-2011 at 12:05 PM.

  7. #7
    Sarcoptes's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wont show up, still >_< argh!
    Code:
            <br>
            "
            echo "<form method=\"post\" action=\"elgsdatabas_uppdatera_lager3.php\" id=\"$title\">
            E-Nummer: <input type=\"text\" name=\"enummer\" value=\"$title\" />
            <input  type=\"submit\" name=\"submit\" value=\"Ok\">
            </form>
            ";
    Last edited by Sarcoptes; 06-30-2011 at 12:14 PM.

  8. #8
    ev1's Avatar Banned
    Reputation
    98
    Join Date
    Nov 2008
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have the page available to show me? i'd like to take a look at the full code if you don't mind....by the way brb like 25 minutes - i'm moving across the country tomorrow, still packing haha

  9. #9
    Sarcoptes's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, sure, I edited out the connecting info ofcourse, since thats yknow, stuff.. :P

    [PHP] <html> <head> <title>Lager Sökning</title> </head> <body> <?php $va - Pastebin.com is the file for search & display
    [PHP] Meh 2 - Pastebin.com is the php file after that, and it works fine.

    I'll be brb a few tens of minutes aswell, as I'm not at home right now, heading home now.
    Also, im not sure if $results should still be neccessary, as i tried using "if over 10 results, do a next arrow and display next 10 results there, etc" - but I thought it was better to just simply display every result in one page for what its going to be used for.

    Also2, the original searchcode was a template from teh interwebz, It's the only thing I needed a template for, since as I said, im a php newb :P


    Cheers for the help sofar.

  10. #10
    ev1's Avatar Banned
    Reputation
    98
    Join Date
    Nov 2008
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this code for the first page: http://pastebin.com/8ygbGnqh

    and i'm not 100% sure what you need done for the 2nd page :X sorry i'm like all over the place today with packing and stuff. if it's urgent that you figure this out you can always hire someone locally quickly or PHP Freaks - PHP Help Index <-- those forums are normally great help when i'm confused on a function

    you did great with showing screenshots with what you wanted, do that again there.
    Last edited by ev1; 06-30-2011 at 03:16 PM.

  11. #11
    Sarcoptes's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I'll try it when I get time, the other file, dunno why I linked it here, I was supposed to save it so I wouldnt forget it :P

  12. #12
    Sarcoptes's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot. This worked perfectly.. silly that the problem was basically just a ; and \ before quotes. D:
    \o

  13. #13
    ev1's Avatar Banned
    Reputation
    98
    Join Date
    Nov 2008
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's amazing how syntax hates new people for those silly mistakes, if you have any questions - let me know. php is my life

Similar Threads

  1. How do I get a file from Maya into WoW?
    By hp94 in forum WoW ME Questions and Requests
    Replies: 6
    Last Post: 03-05-2010, 08:14 AM
  2. Replies: 17
    Last Post: 07-13-2008, 02:11 PM
  3. How to take off rideing skill and level from mounts
    By manager2 in forum WoW EMU Guides & Tutorials
    Replies: 6
    Last Post: 01-12-2008, 04:54 AM
  4. [Guide] How to take away arena points costs from arena vendors PICS
    By chanceless in forum WoW EMU Guides & Tutorials
    Replies: 11
    Last Post: 12-31-2007, 04:18 PM
  5. [GUIDE][PICS]How To Take Off The Riding Skill And Level From Mounts !
    By EmiloZ in forum WoW EMU Guides & Tutorials
    Replies: 8
    Last Post: 12-26-2007, 10:03 AM
All times are GMT -5. The time now is 04:32 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search