473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

PHP Scripting

Hi,

Two things people. Firstly: feed back form, I need the php page to send me
the reply via email whilst masking the email address and for the feedback
form to return the user to to the previous page? Secondly: how could one
create a php script so that it links a flash files' submit to php which in
turn passes the data to MySQL database?

Any help will be greatly appericated.
--
odb69
Jul 17 '05 #1
5 1662
odb69 wrote:
Hi,

Two things people. Firstly: feed back form, I need the php page to send me
the reply via email whilst masking the email address and for the feedback
form to return the user to to the previous page? Secondly: how could one
create a php script so that it links a flash files' submit to php which in
turn passes the data to MySQL database?

Any help will be greatly appericated.


Hi,

That are VERY GENERAL questions.

Some hints: go to www.php.net and llok up:

1) mail() for email.
I don't know what you mean by masking the emailadres, but you can set the
FROM-field while mailing.

2) look up header() for redirecting.
header("Location: http://www.yoursite.com/somepage.html");

3) Flash files submit button?
PHP couldn't care less who/what is posting to the script.
Just make sure you feed the right 'action' to your flashfile, so it points
to a PHP script.
You can use querystring to send data. (I don't know if Flash can POST)
So:
http://www.yoursite.com/highscore.ph...=odb&score=340

and let PHP get the values like this:
$name = $_GET["username"];
$score = $_GET["score"];

4) Insert it into a mysql database?
I suggest you use the INSERT-command....
Regards,
Erwin Moller
Jul 17 '05 #2
odb69 wrote:
Two things people. Firstly: feed back form, I need the php page to send me
the reply via email whilst masking the email address and for the feedback
form to return the user to to the previous page? Secondly: how could one
create a php script so that it links a flash files' submit to php which in
turn passes the data to MySQL database?


Wrote this while trying out PEAR classes:

<?php

/**
* Short script for dumping stuff out of a database
*/

require_once 'HTML/Page.php';
require_once 'HTML/QuickForm.php';
require_once 'HTML/Table.php';
require_once 'DB.php';

$p = new HTML_Page();
$f = new HTML_QuickForm('dumper');

$f->addElement('header',NULL,'Submit your query');
$f->addElement('text','query_string','SQL Query (SELECT only)',
array('size' => 80));
$f->addElement('submit',NULL,'Query');
$f->addElement('reset',NULL,'Reset query');

$p->addBodyContent($f);

if ($_POST['query_string']) {

$dsn = array('phptype' => 'mysql',
'hostspec' => 'your.host.here',
'username' => 'usr_name_here',
'password' => 'usr_passwd',
'database' => 'your_db_name');

$db =& DB::connect($dsn);

if (DB::isError($db)) { die ($db->getMessage()); }
else {

if (!preg_match("/^(UPDATE|INSERT)/i",$_POST['query_string'])) {

$query = stripslashes($_POST['query_string']);

$sth =& $db->query($query);

if (DB::isError($sth)) {
$p->addBodyContent("<p>ERROR<br>Invalid SQL query!</p>");
$p->addBodyContent("<p>" . $sth->getMessage() . "</p>");
}
else {
$t_attributes = array('rules' => 'all',
'frame' => 'border');

$t = new HTML_Table($t_attributes);

$db_header = $db->tableInfo($sth);

$headers = array();

foreach ($db_header as $c => $c_name) {
$headers = array_merge($headers,array($c_name['name']));
}

$header_attr = array('bgcolor' => 'steelblue');

$t->addRow($headers,$header_attr,'TH');

$align_attr = array ('valign' => 'top');
for ($row=0; $row < $sth->numRows(); $row++) {
$t->addRow($sth->fetchRow(), $align_attr);
}

$light = array('bgcolor' => '#CCCCCC');
$dark = array('bgcolor' => '#AAAAAA');
$t->altRowAttributes(1,$light,$dark,TRUE);
$p->addBodyContent($t);
}
}
else {
$p->addBodyContent("<p>Sorry, only SELECT queries allowed!</p>");
}
}
}

$p->display();
?>
Jul 17 '05 #3
Thanks for your help.


--
odb69



__________________________________________________ ________________________
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:41***********************@news.xs4all.nl...
odb69 wrote:
Hi,

Two things people. Firstly: feed back form, I need the php page to send
me
the reply via email whilst masking the email address and for the feedback
form to return the user to to the previous page? Secondly: how could one
create a php script so that it links a flash files' submit to php which
in
turn passes the data to MySQL database?

Any help will be greatly appericated.


Hi,

That are VERY GENERAL questions.

Some hints: go to www.php.net and llok up:

1) mail() for email.
I don't know what you mean by masking the emailadres, but you can set the
FROM-field while mailing.

2) look up header() for redirecting.
header("Location: http://www.yoursite.com/somepage.html");

3) Flash files submit button?
PHP couldn't care less who/what is posting to the script.
Just make sure you feed the right 'action' to your flashfile, so it points
to a PHP script.
You can use querystring to send data. (I don't know if Flash can POST)
So:
http://www.yoursite.com/highscore.ph...=odb&score=340

and let PHP get the values like this:
$name = $_GET["username"];
$score = $_GET["score"];

4) Insert it into a mysql database?
I suggest you use the INSERT-command....
Regards,
Erwin Moller

Jul 17 '05 #4
"odb69" <s_******@yahoo.co.uk> wrote in message
news:ct**********@sparta.btinternet.com...
Hi,

Two things people. Firstly: feed back form, I need the php page to send me
the reply via email whilst masking the email address and for the feedback
form to return the user to to the previous page? Secondly: how could one
create a php script so that it links a flash files' submit to php which in
turn passes the data to MySQL database?


Another way to submit data from Flash to a server running PHP is through
Flash Remoting. Check out the examples at www.amfphp.org.
Jul 17 '05 #5
I would strongly reccomend trying out the PhpMailer
(http://phpmailer.sourceforge.net/)
mail library. it's very easy to use and has good features.

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: The_Incubator | last post by:
As the subject suggests, I am interested in using Python as a scripting language for a game that is primarily implemented in C++, and I am also interested in using generators in those scripts... ...
41
by: Richard James | last post by:
Are we looking at the scripting world through Python colored glasses? Has Python development been sleeping while the world of scripting languages has passed us Pythonista's by? On Saturday...
33
by: Quest Master | last post by:
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting...
9
by: What-a-Tool | last post by:
Dim MyMsg Set MyMsg = server.createObject("Scripting.Dictionary") MyMsg.Add "KeyVal1", "My Message1" MyMsg.Add "KeyVal2", "My Message2" MyMsg.Add "KeyVal3", "My Message3" for i = 1 To...
0
by: fiona | last post by:
Catalyst Releases Scripting Editions of SocketTools Client and server-side development for Active Server Pages and PHP. Yucca Valley, CA, May 25, 2005 - Catalyst Development Corp...
8
by: rmacias | last post by:
I am maintaining an application that was writting in VB6 and has VBA 6.2 integrated into it. The VBA SDK allows the users of the application to generate VBA projects and scripts to gain access to...
6
by: Wolfgang Keller | last post by:
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database...
1
by: andrewcw | last post by:
I have used System.Management in the past to extract and walk thru drives & check their type. I can also do it with COM's FileSystemObject. Here I am trying to just use the Management Object...
2
by: James | last post by:
Are there any classes in c# for this or am I left to use the com interface, which I'm not sure how. And if I have this will it work on a machine that someone has disabled scripting? Finally,...
7
ADezii
by: ADezii | last post by:
The next series of Tips will involve the Microsoft Scripting Runtime Library (Scrrun.dll). This Library is, in my humble opinion, one of the most useful and practical Libraries ever created. With the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.