SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Complete blank moment.

    I'm trying to get my site to be more dynamic.
    Not too skilled with PHP, but know enough to get me by,

    but there HAS to be a better way than this?

    PHP Code:
    <html>
    <body>


    // display data based on click below
    <?php
    $test 
    $_POST['test'] ;
    echo 
    $test
    ?>



    <form id="myForm" method="post" action="download.php">q
    <a href="#" onclick="document.getElementById('myForm').submit();">Test1 </a>
    <input type="hidden" name="test" id="test" value="biscuit"class="input" />
    </form>


    <form id="myForm2" method="post" action="download.php">
    <a href="#" onclick="document.getElementById('myForm2').submit();">Test2 </a>
    <input type="hidden" name="test" id="test" value="biscuit2"class="input" />
    </form>
    Help me!

    Cheers!

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    what do you mean?
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    177
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <input type="submit" value="Test1" />
    Replace your Javascript-link combination thing with that. You'll have a submit button then, which does the exact same thing your Javascript-link combination thing does, but less complicated and more usable (people with Javascript disabled will be able to use it too)

  4. #4
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but basically what I want is a page with 5 options, and upon clicking the options text appears on the page.

    If I can make this in PHP, the text in the mysql database, then I can cut down the amount of pages I need to make from 25 to 5.

    Possible?

  5. #5
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You could make it much easier by referencing the page in $_GET. for example:
    PHP Code:
    <html>
    <body>
    <?php
    $test 
    $_GET['test'];
    echo 
    $test;
    ?>
    <a href="download.php?test=biscuit">Test1</a>
    <a href="download.php?test=biscuit2">Test2</a>
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    So, have you already got a database running?
    And have you got all your text in it, in a table?

    If not, do that first.

  7. #7
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    and reference the pages through the ID of the page record, like this:
    PHP Code:
    <html>
    <body>
    <?php
       $id 
    $_GET['id'];
       
    $q mysql_query("SELECT `Text` FROM `Content` WHERE `id`= '".$id."'");
       echo 
    mysql_result($q0);
    ?>
    <a href="download.php?id=1">Test1</a>
    <a href="download.php?id=2">Test2</a>
    Off Topic:

    Watch out, cups. 48 more posts and you'll need to change you sig! (1000 posts turns you into a "sitepoint wizard")
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  8. #8
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's the one mate - cheers!

  9. #9
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Off Topic:

    Watch out, cups. 48 more posts and you'll need to change you sig! (1000 posts turns you into a "sitepoint wizard")
    [/QUOTE]

    No way mate, I always quit at 1000. (paulyg, foofoonet)

    Like my sig says, I am not a guru, never mind a wizard. Just 'cause someone can make 1000 sometimes inaccurate or misleading guesses shouldn't bestow any more greatness or validity upon their gushings. I am uncomfortable with these labels.

    Neither 500 nor 1000 nor even 5000 postings makes you an authority, not like some of the real gurus that do visit occasionally.

    This scoring system is imperfect, but hey-ho - lets just get on and do our best, eh? Sometimes the best thing for the Original Poster is for me to bite my lip and NOT answer the question, because there are things about the subject I suspect I don't know, and leaving a "0 replies" marker attracts the real gurus in.

    Very often, by replying and helping someone, I expose my own inexperience. This is sometimes humbling and sometimes can sting a bit, but is the main reason I come back - to learn.

    In giving one receives... no?

    If I am really honest though, I do have other reasons for killing myself off:

    Carrying around 1000 postings is a bit like carrying baggage, if you come across someone you upset, or you take umbridge at some poster, as happens, - I have found that I can start to become a bit righteous, defensive and and even uppity. Its also inevitable no matter how courteous you try and be that you collect detractors, who either ignore you, or worse, become 'snipers' following your posts picking off things like syntax errors - ever experienced that? Starting with a new personality is very refreshing.

    I think I have cured myself of this one though... I used to have a few glasses of wine, then come back onto the forum like some alcohol-fuelled superman and be able to comment wittily (as I thought) on just about anything - then the next morning have to come back on and apologise for my unfunny and slightly abusive posts. I hated that - it felt a bit like drunk-driving.

    The other reason for doing it is slightly self-centred I suppose, just in case I ever apply for a job I should be able to point to my on-line 'personality' and say 'Look, I have done my bit to give something back to the (php) community' - which is the real reason I started hanging round SP in any case.

    Paul.

  10. #10
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    lol, so that's where tictac got it from...
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •