?
Solved

User Login in HTML - SQL Query - Dump Data back to HTML Page.

Posted on 2003-03-04
4
Medium Priority
?
180 Views
Last Modified: 2013-12-25
Say I have a web page made from a Template, and the editable area is made up of a HTML table.

I want to make up a perl script that will ask for a user name/password login, then after you submit the info, the perl script connects to a Mysql database on the localhost using the POST data. It then performs a basic query (SELECT * FROM TABLE), and then dumps the query back into the orgional HTML table on the HTML template or dumps the info to a new page but made from the same template and dumping into the correct HTML Table.

Note that the login page should be contained inside the HTML template Table.

The main thing would be that instead of getting a new clear page made from the cgi script, I would get the actual query back into the template I started with.  It wouldn't matter if the page was reloaded, as long as the rest of the template was still there.

Did I explain this correctly? Is this possible?

Thanks a bunch.
0
Comment
Question by:Airgazm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8071791
> .. as long as the rest of the template was still there.

what do you mean by "there" ?
Could you please explain.
0
 

Author Comment

by:Airgazm
ID: 8074196
Well, I am new to CGI and perl and I have written a few web pages.  

All the simple scripts I have got working present the data in a new page.  I mean if I ask for variables in a HTML form and submit it, the data returned goes into a new page.

I want to get that data back into the page I started from or at least make it look like it is in the same page.  

I can get it to work with PHP, because PHP lets you mesh the PHP code in with the HTML, but that dosen't seem to be the case with Perl.  I just found out about Mason, is that what I should be using here to do this?

Thanks
0
 

Accepted Solution

by:
Macane earned 600 total points
ID: 8402264
i'm using ReadParse this basicly takes any values in a form send by POST or GET and puts it into an array, which then will contain your previously posted data.

// code snippet start //
#!usr/bin/perl
#Let's say you got a form with 2 fields firstname and lastname
require "cgi-lib.pl";
&ReadParse(*data);

#First run of page
if (!&data) {
#if nothing was in the data var this must be the first time the page is run print the form.
  Do you thing here with form html code.
}
else {
#it seems that something was in the form.
  Do your thing with Html just add theese into the data place of the form.
}
// code snipper stop //

To get the data out of the data array do like this.
$data{'firstname'}
$data{'lastname'}
I would suggest that you build it up with some if sentences like this.
$lastname = "";
if ($data{'lastname'} {
  $lastname = $data{'lastname'}
}
and then simply make a sub that prints the form html with the $variables in them.

Hope this helps a bit if not just ask :)

Christian
0
 

Expert Comment

by:Macane
ID: 8402286
I forgot about the html part, but it should be a simple task to create a search sentence when you got the transfer of variables from page to page going.

for instance.

$searchstring = "SELECT * FROM TABLE WHERE LASTNAME=$lastname"

Or whatever you need todo with the variables.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question