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 10:26 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Hi, whoever you are who is going to solve this.
PostPosted: Fri Sep 23, 2022 10:05 pm 
Offline

Joined: Tue Jun 16, 2015 1:03 am
Posts: 21
Attachment:
scr03.png
scr03.png [ 34.98 KiB | Viewed 101567 times ]
Attachment:
scr01.png
scr01.png [ 21.84 KiB | Viewed 101567 times ]
Quote:
I like to code programs that make life a
little easier. This project is to display accounts in a database I use showing login info,
lastime used and number of times. I also want to be able to click and go to the account.

Everything works except that I can't relocate to the url. I include screenshots of the
progression.

screen1) ready for account selection for
select
screen2) shows account chosen
submit
screen3) shows row with information
go to url
screen4) result

and the current code:

Code:
<!DOCTYPE><html><head><title>email menu</title></head>
<body><center>
<form name="form" method="post" action="">
<?php
$con=mysqli_connect("localhost","root","","homedb");
//============== check connection
if(mysqli_errno($con))
{echo "Can't Connect to mySQL:".mysqli_connect_error(); exit; }
else
{echo "Connected to mySQL</br>";}
//This creates the drop down box
echo "<select name= 'target'>";
echo '<option value="">'.'--- Select lookup account---'.'</option>';
$query = mysqli_query($con,"SELECT target FROM emailtbl");
$query_display = mysqli_query($con,"SELECT * FROM emailtbl");
while($row=mysqli_fetch_array($query))
{echo "<option value='". $row['target']."'>".$row['target']
.'</option>';}
echo '</select>';
?>
<p><p>
<CENTER>then

<input type="submit" name="submit" value="Submit"/>
</form>
<?php
if(isset($_POST['target']))
{
$name = $_POST['target'];
$fetch="SELECT id, target, called, username, password, purpose, emailused,lastused, count FROM emailtbl WHERE target = '".$name."'";
$result = mysqli_query($con,$fetch);
if(!$result)
{echo "Error:".(mysqli_error($con));}
//display the table
echo '<table border="1">'.'<tr>'.'<td bgcolor="#ccffff align="center">'. 'lookup menu'. '</td>'.'</tr>';
echo '<tr>'.'<td>'.'<table border="1">'.'<tr>'.'
<td bgcolor="#CFB53B align="center">'.'id'.'</td>'.'
<td bgcolor="#CFB53B align="center">'.'target'.'</td>'.'
<td bgcolor="#CFB53B align="center">'.'called'.'</td>'.'
<td bgcolor="#ccffff align="center">'.'username'.'</td>'.'
<td bgcolor="#ccffff align="center">'.'password'.'</td>'.'
<td bgcolor="#ccffff align="center">'.'purpose'. '</td>'.'
<td bgcolor="#ccffff align="center">'.'emailused'.'</td>'.'
<td bgcolor="#CFB53B align="center">'.'lastused'.'</td>'.'
<td bgcolor="#CFB53B align="center">'.'count'. '</td>'.'</tr>';
while($data=mysqli_fetch_row($result))
{echo ("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td>
<td>$data[4]</td><td>$data[5]</td><td>$data[6]</td><td>$data[7]</td><td>$data[8]</td></tr>");}
echo '</table>'.'</td>'.'</tr>'.'</table>';
$id="id";
$target="target";
$count="count";
$lastused="lastused";
$sql = "UPDATE emailtbl SET lastused=NOW(), count=$count + 1 WHERE id=$id";
if ($con->query($sql) === TRUE) { echo "Record updated successfully"; }
else { echo "Error updating record: " . $con->error; }
}
?>
<p>
<button onclick="myFunction('<?php echo $target;?>')">go to url</button>
<?php
?>
</body></html>


Attachments:
scr02.png
scr02.png [ 22.11 KiB | Viewed 101567 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 43 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