CodeLobster IDE
http://codelobster.com/forum/

link with mysqli
http://codelobster.com/forum/viewtopic.php?f=3&t=24753
Page 1 of 1

Author:  12Strings [ Sat Mar 07, 2020 1:21 am ]
Post subject:  link with mysqli

All the code below is intended to and does create a dropdown which selects a record(url)
and submit produces and does not display a table row with a link to the record.
"select & submit" goes back to "select & submit". I've been working on this along time.
anyone work with mysqli?
-----------------------------------------------------------------
Code:
<!DOCTYPE><html><head>
<title>lookup menu</title>
</head>
<body><center><b>
<form name="form" method="post" action="">

<?php
// error_reporting(0);
error_reporting(E_ALL ^ E_NOTICE);
include 'homedb-connect.php';

//This creates the drop down box
echo "<select name= 'target'>";
echo '<option value="">'.'--- Select account ---'.'</option>';
= mysqli_query(,"SELECT target FROM lookuptbl");
= mysqli_query(,"SELECT * FROM lookuptbl");
while(=mysqli_fetch_array())
{echo "<option value='". ['target']."'>".['target']
.'</option>';}
echo '</select>';
?>
<input type="submit" name="submit" value="Submit"/>
</form><center>

<?php
// error_reporting(0);
error_reporting(E_ALL ^ E_NOTICE);
include 'homedb-connect.php';

// ==============================================
if(isset(Array['target']))
{
= Array['target'];
// ===============================================
="SELECT target, purpose, user, password, email, visits, date, saved
FROM lookuptbl WHERE target = '". mysqli_real_escape_string (  ,  ) . "'";
// ===============================================================================

= mysqli_query(,);
if(!)
{echo "Error:".(mysqli_error());}

//display the table
        echo '<table border="1"><tr><td bgcolor="#ccffff" align="center">lookup menu</td></tr>
        <tr><td>
        <table border="1">
        <tr bgcolor="#ccffff">
        <td> Target </td>
        <td> Purpose </td>
        <td> User </td>
        <td> Password </td>
        <td> Email </td>
        <td> Visits </td>
        <td> Date </td>
        <td> Saved </td>
        </tr>';

        while(=mysqli_fetch_row())                             
          {

// ==========================================================
= "http://localhost/home/crud-link.php?target=". [0];
= '<a href="'..'">'. [0]. '</a>';
// ===========================================================

echo ("<tr><td>  </td><td>[1]</td><td>[2]</td><td>[3]</td>
<td>[4]</td><td>[5]</td><td>[6]</td><td>[7]</td></tr>");
}     
        echo '</table>
        </td></tr></table>';
  }
?>
</body></html>

Author:  Admin [ Tue Mar 24, 2020 2:34 pm ]
Post subject:  Re: link with mysqli

Hi.

You form uses POST method.
So You should work with $_POST instead of $_GET

Code:
if(isset(Array['target']))
{
= Array['target'];


Regards,
Codelobster Team.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/