CodeLobster IDE

Free cross-platform PHP IDE (HTML, PHP, CSS, JavaScript, Python code editor) with support Drupal, Joomla, Twig, JQuery, BackboneJS, LaravelJS, Node.js, CodeIgniter, CakePHP, Laravel, Magento, MeteorJS, Phalcon, Symfony, VueJS, WordPress, Yii
It is currently Thu Mar 28, 2024 7:58 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: link with mysqli
PostPosted: Sat Mar 07, 2020 1:21 am 
Offline

Joined: Tue Jun 16, 2015 1:03 am
Posts: 21
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>


Top
 Profile  
 
 Post subject: Re: link with mysqli
PostPosted: Tue Mar 24, 2020 2:34 pm 
Offline
Site Admin

Joined: Wed Sep 12, 2007 2:18 pm
Posts: 3931
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 53 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2016 phpBB Group