Jump to content

Recommended Posts

Hello i kinda new to programing mostly learning myself stuf there so i need some help to figure out.

so i have lets say static link who always same and i write something in input field and press search button. so i get new link and immediately going to dat link, which means i leaving my site. in my case i working with image

so my problem, is it somehow possible to display image in same page while writing someting in input field when presing button and image just change down below not going directly to link ? 

P.S. sory for my english :)

 

i have this code 

<html>
    <head>
    <meta charset="utf-8">
        <title>Finder</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>

<body>

    <center>
    <h1>  <strong>Finder<br>
      <br>
      </strong></font></h1>

    <form action="#" method="POST">
        <input type="hidden" name="link" value="src1">
        <input type="text" name="inputpart" placeholder="inputpart" size="40">
        <input type="submit" name="submit" value="Search" >

    </form>
        </center>

    <?php require_once 'linkgenerator.php' ?>
</body>
</html>

 

PHP link generator code 

<?php
    if (isset($_POST['link'])) {
        if ('src1' === $_POST['link']) {
            header("Location: https://staticlink" . $_POST["inputpart"] . ".png");
        }
    }
    ?>

 

 

Edited by eagle101

You need to use JavaScript to change page contents without refreshing or redirecting the page. Basically, you'll attach a click handler to your button that reads the contents of your input field, uses AJAX to communicate with a PHP script on the server - it's this script that will figure out what image to serve up - and then replaces the image with the information sent back from the PHP script.

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.