Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Dynamic Paragraph (with PHP)?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #23923
    synic
    Member

    This could probably be done a few different ways, but I want to figure out how to use PHP to accomplish this.

    So, I want to be able to have the text contained in a certain p element change when the corresponding image is clicked.

    I want to do this so that everything will happen on the one page instead of having to created x amount of pages for all the images/text I have.

    I’m probably making this harder than it really is. Any help/advice is appreciated. Thanks.

    #52901
    synic
    Member

    Nevermind…

    I think I figured it out.

    #52903
    synic
    Member

    Ok well, now I have a new issue.

    The way I got it to work is by setting different variables for each new block of text. I used a switch statement to have the blocks of text change when the corresponding image is clicked. However, when you first load the page, all you see are the images you can click to show the text.

    Now I’m trying to figure out how to have text already be on the page and then be replaced when an image is clicked and not seen again until the entire page is reloaded.

    Any ideas?

    #52904
    synic
    Member

    Wow, nevermind, I’m dumb..

    :D

    #53137
    synic
    Member

    Well, like I said before, I accomplished this by using a switch statement. However, on this same page, I have a tiny contact form that is also using PHP. My problem now is when you click "send" to submit the form, the page reloads/refreshes instead of staying in the current state.

    If anyone knows how to make the page stay at whatever is currently loaded instead of refreshing when the "send" button is pressed, please enlighten me. Thanks!

    #53154
    Argeaux
    Participant

    you can use ajax to send the form in the background so the user still stays on the same page without a refresh. Or you could save the current page in a session, and after you submit the form you look in the session what page you were on and go there again.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Other’ is closed to new topics and replies.