473,408 Members | 2,839 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,408 software developers and data experts.

The Challenge is On for the PHP Script Guru'S

Hi there, I need serious help. Ive got a project that needs some unique select box function.


OK THERE IS A LOT OF Code but If you Crack it youll get the credit.

just mail me at info@malachite.de with your Info you wold like posted

My issue:

1. I've got two select boxes, of wich one gets filled with MYSQL Data.. Works great...
2. A Javascript sends the selected items (Values) to select box two.. Works great..
3. Now I would like to write the following values into a database table BUT! not as comma delimited, as single entries.

Theory: A user selects a number of links(URL's) that he would like to be listed under
After writing the urls to his account, his url will be displayed on the selected domains.


Select box 1 >> Select box 2
----------------------------------------------------
Record1 | Record1 - -|
Record2 | Record2 | >> Write to database
Record3 | Record4 |
Record4 | --|
Record5 |
------------------------------------------------------

The solution will be rewarded with a: Code contibuted by "YOURNAME "..online ont the web site

Here is the working code for the 2 select boxes and data connection:


<html>
<head>
<title>Move List</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function MoveOption(objSourceElement, objTargetElement)
{
var aryTempSourceOptions = new Array();
var x = 0;
//looping through source element to find selected options
for (var i = 0; i < objSourceElement.length; i++) {
if (objSourceElement.options.selected) {
//need to move this option to target element
var intTargetLen = objTargetElement.length++;
objTargetElement.options[intTargetLen].text = objSourceElement.options.text;
objTargetElement.options[intTargetLen].value = objSourceElement.options.value;
}
else {
//storing options that stay to recreate select element
var objTempValues = new Object();
objTempValues.text = objSourceElement.options.text;
objTempValues.value = objSourceElement.options.value;
aryTempSourceOptions[x] = objTempValues;
x++;
}
}
//resetting length of source
objSourceElement.length = aryTempSourceOptions.length;
//looping through temp array to recreate source select element
for (var i = 0; i < aryTempSourceOptions.length; i++) {
objSourceElement.options.text = aryTempSourceOptions.text;
objSourceElement.options.value = aryTempSourceOptions.value;
objSourceElement.options.selected = false;
}
}
//-->
</SCRIPT>
</head>
<body>
<table width="64" border="0" cellspacing="1" cellpadding="1" bgcolor="#000066">
<tr>
<td>
<div style="position:relative;width:404px;height:437px; background-color:#fff;-adbe-g:p;">
<div style="position:absolute;top:32px;left:0px;width:3 36px;height:384px;background-color:#fff;-adbe-c:c">
<form action="dbwriterres.php" method ="post" name="MoveList">
<table>
<tr>
<td align="center"><font face="Arial,Helvetica,sans-serif" size="2"><b>Verfugbare<br />
Links</b></font></td>
<td>
<p></p>
</td>
<td align="center"><font face="Arial,Helvetica,sans-serif" size="2"><b>Selektierte Links</b></font></td>
</tr>
<tr>
<td><select name="Enabled" size="18" multiple="multiple" style="width: 150px;">
<?php
$db_host4 = "my_db";
$db_user4 = "password";
$db_pwd4 = "";
$db_name4 = "dbname";
mysql_connect($db_host4, $db_user4, $db_pwd4);
mysql_select_db($db_name4);
$sql = "SELECT * FROM geostorm.url_main where scontent not like 255 ";
$query = mysql_query($sql);
do { ?>
<option selected value="<?php echo $row['url']?>"><?php echo $row['url']?></option><?php } while ($row = mysql_fetch_assoc($query));
$row = mysql_num_rows($query);
if($row > 0) {
mysql_data_seek($query, 0);
$row = mysql_fetch_array($query);
}
?>
</select></td>
<td><input type="button" name="Disable" value=">> " style="width: 80px;" onclick="MoveOption(this.form.Enabled, this.form.Disabled)" /><br />
<br />
<input type="button" name="Enable" value=" <<" style="width: 80px;" onclick="MoveOption(this.form.Disabled, this.form.Enabled)" /><br />
</td>
<td><select name="Disabled" size="18" multiple="multiple" style="width: 150px;"></select></td>
</tr>
</table>
<input type="submit" name="submitButtonName" value="Write to Customer">
</form>
</div>
<div style="position:absolute;top:0px;left:40px;width:3 20px;height:32px;-adbe-c:c">
<div align="center">
<font face="Arial,Helvetica,sans-serif"><b>Server Link Swap</b></font></div>
</div>
<div style="position:absolute;top:416px;left:0px;width: 400px;height:20px;-adbe-c:c">
<div align="center">
Version: V12.0</div>
</div>
</div>
</td>
</tr>
</table>
</body>
</html>

Ps Feel free to use this code as you like!

Kind Regards

Malachite A.K.A Lazy Larry
Dec 18 '06 #1
2 1660
Here is the Table data for for the two tables involved:

`geostorm`.CREATE DATABASE `geostorm` /*!40100 DEFAULT CHARACTER SET latin1 */;


Linkui table: Database name geostorm

DROP TABLE IF EXISTS `geostorm`.`linkui`;
CREATE TABLE `geostorm`.`linkui` (
`knr` int(10) unsigned NOT NULL auto_increment,
`uid` int(10) unsigned NOT NULL,
`url` varchar(255) NOT NULL,
`nid` varchar(45) NOT NULL,
PRIMARY KEY (`knr`,`uid`),
KEY `FK_linkui_1` (`uid`)
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;


url_main table:

DROP TABLE IF EXISTS `geostorm`.`url_main`;
CREATE TABLE `geostorm`.`url_main` (
`urlid` int(10) unsigned NOT NULL auto_increment,
`url` varchar(255) NOT NULL,
`description` varchar(45) NOT NULL,
`keywords` varchar(45) NOT NULL,
`linkname` varchar(45) NOT NULL,
`urltype` tinyint(1) NOT NULL,
`hidden` tinyint(1) NOT NULL,
`scontent` tinyint(3) unsigned NOT NULL,
`catagoryid` int(10) unsigned NOT NULL,
PRIMARY KEY (`urlid`)
) ENGINE=MyISAM AUTO_INCREMENT=2363 DEFAULT CHARSET=utf8;


Just so you know what your dealing with:

Url data is selected from on table and inserted into the othe so obviously 8url) should be the key transfer data.

Some sample data for table two(url_main)

INSERT INTO `geostorm`.`url_main` (`urlid`,`url`,`description`,`keywords`,`linkname` ,`urltype`,`hidden`,`scontent`,`catagoryid`) VALUES
(1,'http://www.test.de','','test, test, test, test','test',0,0,0,0),
(2,'http://www.test.info','','test, test, test, test','test',0,0,0,0),
(3,'http://www.test.com','','test, test, test, test','test',0,0,0,0);

Lots of fun for any one" I wonder who will crack this one".

Malachite
Dec 18 '06 #2
ronverdonk
4,258 Expert 4TB
I will never let myself be challenged into such a competiiton. Epecially not in this forum, of which the goal is to help people with (for them) serious problems, and not to enter some free-for-all code competition for some company.

And please read the Posting Guidelines at the top of this forum. Especially the part about enclosing code within code, php or code tags! You really do not encourage people to read this unstructured bunch 120 lines of code from their screens.

Ronald :cool:
Dec 19 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Artco News | last post by:
I thought I ask the scripting guru about the following. I have a file containing records of data with the following format(first column is the label): CODE#1^DESCRIPTION^CODE#2^NOTES...
3
by: Brian Murphy | last post by:
<?php /* A challenge to every PHP programmer.The one who's gonna solve this problem would be deemed as PSP(PHP Supreme Programmer).The problem is this : You have to write a script that...
9
by: Stuart | last post by:
Hi All, I got a challenge to make the same APS/Script/Html run on different web roots. I can not use relative pathing in a lot of cases. We use lots of included files so depending on where that...
2
by: paulp | last post by:
Greetings, I'm working on a CGI program that will run under MS IIS 5.0 and will browse folders on three other machines, building HTML pages that will provide links to these folders. ...
1
by: .Net Newbie | last post by:
I am relatively new to .Net and have been coding an intranet site for my employer for a couple of months. I am currently stuck coding in a text-editor called EditPlus without access to the VS.Net...
0
by: .Net Newbie | last post by:
I am relatively new to .Net and have been coding an intranet site for my employer for a couple of months. I am currently stuck coding in a text-editor called EditPlus without access to the VS.Net...
5
by: glegipon | last post by:
As Tom Cahill would require, my challenge is (according to the "three R's") Reproducible: if run on OS 9.x, the monthly payment does not show up in the text box: Recognizable: I believe the...
8
by: Senderos | last post by:
Hello, i try to break this code, since many days (and nights), without any success : <script type="text/javascript"> function p(a,i,c) { var x=a.charCodeAt(i)+c;
16
by: Singulus | last post by:
Hello all, I've searched for similar threads, I've found some bit of useful info here and there, but nevertheless I want to post my questions...So, how can I (we, in fact the forum can benefit...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.