Announcement

Collapse
No announcement yet.

opening entered website from form

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • opening entered website from form

    !PHP! guess who's back? I have a php form where i enter a site name and the name of the site i entered is displayed. only problem is, I don't know how to get that site to load. what do i do? I'm familiar with how to do it with html, but it's gotta be different with php, right? in a perfect world, someone types in a website and then the textbox becomes unresponsive once the url is inputed but the whole world can see what was put in the input box. How would i go about getting that done? I don't need the exact code, but any help is obviously appreciated.
    PHP Code:


    <html>
    <head>
    </head>
    <body>



    <form action="insertsiteform.php" method="post">
    Site: <input type="text" name="sitename"><br/>
    <input type="submit" name="submit">

    </form>


    <?php
    if (isset($_POST['submit'])) {


    $con mysql_connect("localhost","DATABASE","PASSWORD");
    if (!
    $con) {
    die (
    "can't connect" mysql_error());
    }

    mysql_select_db("DATABASE"$con);

    $sql "INSERT INTO search (site) VALUES ('$_POST[sitename]')";


    mysql_query($sql,$con);




    mysql_close($con);
    }
    ?>



    <?php



    $con 
    mysql_connect("localhost","DATABASE","PASSWORD");
    if (!
    $con) {
    die (
    "can't connect" mysql_error());
    }

    mysql_select_db("DATABASE",$con);

    $sql "SELECT * FROM search";
    $myData mysql_query($sql,$con);
    while(
    $record mysql_fetch_array($myData)){
    echo 
    $record['site'] ;

    ;
    echo 
    "<br />";

    }
    mysql_close($con);

    ?>


    </body>
    </html>

    photo for reference
    Last edited by rubecuber; 04-24-2016, 01:55 PM. Reason: added a photo

  • #2
    I think i'm going to have to do some jquery stuff. I don't really know how to do that, but i'll try and figure it out and keep you posted

    Comment


    • #3
      I'm wondering.... since i have this all set up with html, is there a way i can have the output from my php file show up in the html form and then have the php form inactive or have the php submit button become inactive?

      Comment


      • #4
        i'm trying to get the output of the php form to show up in an html form. embedding it doesn't seem to work

        Comment


        • #5
          You will want to use file_get_contents
          Have a Script or Snippet you want to share?

          WWW Standards: HTML 4.01,
          HTML 5, CSS2.1, CSS3, XHTML 1.0
          PHP Standards: PHP Standards

          Comment

          Working...
          X