JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 26th, 2001, 12:54 PM
Helios Helios is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Chicago, USA
Posts: 73 Helios User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Unhappy

Before I ask my question please use the following URL's as reference b/c this may sound a bit confusing:

http://www.digitalbait.com/product_...products_id=35&

http://www.digitalbait.com/Outward/...u%253D580214895

The first URL is the products page and the second URL is the page of the product on an external site with a top frame linking back to my site. I have a button in the top frame that mail the URL (everything after ?url=) to a designated address using the mail(); function.

When the button on the top frame is clicked a new window opens notifying the user that the URL was sent. The way I originally had it written was to have a new browser window open with <target="_blank"> but I wanted to use javascript instead so I could control the size of the popup.

Without javascript the full URL was sent just fine but now that I implemented the javascript only part of the URL is being sent. urlencode is supposed to take care of this problem (which it does without javascript). Here is the original code and also the current code:

Original code:
Code:
<html>
<head>
	<title>Thanks for using DigitalBait</title>
</head>
<?php 
$qs = "?url=" . urlencode($url);
$URL = "broken_link.php" . $qs;
?>
<form method="post" action="<? echo($URL); ?>" target="_blank">
...rest of page...
<input type="image" name="submit" src="/images/frame/submit_link.gif" border="0" vspace="2" hspace="5">


Current code:
Code:
<html>
<head>
	<title>Thanks for using DigitalBait</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function popUp(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=300,height=75  ');
self.name = "mainWin"; }
</SCRIPT>
<?php 
$qs = "?url=" . urlencode($url);
$URL = "broken_link.php" . $qs;
?>
<form method="post" action="javascript:popUp('<? echo($URL); ?>')">
...rest of page...
<input type="image" name="submit" src="/images/frame/submit_link.gif" border="0" vspace="2" hspace="5">


The popUp window displays the following:
Code:
<html>
<body bgcolor="#cc6600">
<font face="verdana" size="2" color="white">

<?php
$to = "me@myaddress.com";
$subj = "Broken Link Report";
$body = $url;

$success = mail ($to, $subj, $body);
if ($success) {
echo ("The problem link was sent and we will get it fixed as soon as possible.  Thank you for your cooperation.");
} else {
echo ("Error sending mail.  Please resubmit link.");
}
?>
</font>
<br>
<div align="right"><FORM><font face="verdana" size="1" color="white">Close Window:&nbsp;<INPUT TYPE='BUTTON' VALUE='x' onClick='window.close()'></FORM></div>
</body>
</html>

What is it about the javascript that wont let urlencode do its job? I'm pulling my hair out over this one... Thanks in advance.

Reply With Quote
  #2  
Old January 26th, 2001, 04:28 PM
JohnB JohnB is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Location: UK
Posts: 527 JohnB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
I guess yoy don't want to be using post to submit to a javascript function. Try something like this:

<form>
...rest of page...
<input type="image" name="submit" src="/images/frame/submit_link.gif" border="0" vspace="2" hspace="5" onClick="popUp(<? echo($URL); ?>)">
</form>

ie. use the onClick of the image to call the jscript. I may have missed some ' or "

John

Reply With Quote
  #3  
Old January 26th, 2001, 04:44 PM
Helios Helios is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Chicago, USA
Posts: 73 Helios User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Thumbs up

JohnB,
Thanks a lot, that did the trick. I'm still trying to understand why but I guess it doesn't matter now that it is working.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > mail(); & javascript & urlencode...please help!!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT