 |

09-30-2004, 07:49 PM
|
|
WebProWorld New Member
|
|
Join Date: Apr 2004
Location: www.rapidbikes.co.uk
Posts: 9
|
|
Link variable (PHP)
Hello,
I don't really know much about PHP but you've got to start somewhere.
I wondered if anyone could help me. I'm trying to open a new window set to a specific size and with no toolbars etc when clicked on a picture. I can open a new window using target="_blank" but when I put in the rest of the code it wont accept it: <a href='$picName' onclick="window.open('$picname.htm','','width=550, height=480','resizable=no','scrollbars=no'); return false;" target="_blank">I'm guessing its because of the JavaScript but I'm not sure how to fix it.
Matt
|

09-30-2004, 08:16 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Aug 2003
Location: Central US
Posts: 1,581
|
|
I cannot see your entire script file, so I am assuming that you have the code inside of standard Html.
Try wrapping your variables as such <? variable >
Code:
<a href='<?$picName>' onclick="window.open('<?$picname>.htm','','width=550,height=480','resizable=no','scrollbars=no'); return false;" target="_blank">
Also, what is the name of the file you are running. It must end with a php extension in order for the server to parse it as php thru the interpreter.
|

10-01-2004, 10:08 AM
|
|
WebProWorld New Member
|
|
Join Date: Apr 2004
Location: www.rapidbikes.co.uk
Posts: 9
|
|
PHP
Thanks for your reply, that was well quick!
Basically I've built my website using html and JavaScript, I don't actually know much about PHP, I've had some written for me for free so that a customer can submit an advert and I can go on line in the admin database and accept/decline or edit the advert before it appears live. Most of this works very well, there's just a few things I'd like to change, one of them is when a user clicks on a thumbnail to see the fullsize picture I would like the picture to appear in a window at a set size with no toolbars. I know how to do this within html but not within php. The file is called advertisement.php which starts with <?php I presume it's the onclickevent it doesn't like or maybe its because I have a $variable in the middle of it. Here's a bit more of the code
|

10-02-2004, 03:33 PM
|
|
WebProWorld New Member
|
|
Join Date: Apr 2004
Location: www.rapidbikes.co.uk
Posts: 9
|
|
PHP
Help
Does anyone know how to make JavaScript work within PHP, I can't get the onclick event to work
Code:
$s="[img]$picName[/img]";
I just want to be able to open a window set to a specific size etc. I Can do it in html but not within PHP.
any help much appreciated
Matt
|

10-02-2004, 03:36 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Aug 2003
Location: Central US
Posts: 1,581
|
|
I tell you what. Can you take your php file and copy it over to another file with a .txt extension, then post the link to that file here? That way I or someone else can grab it and run it thru on their local machine to see what is what. We will probably need to see this file in it's entirety
|

10-02-2004, 03:53 PM
|
|
WebProWorld New Member
|
|
Join Date: Apr 2004
Location: www.rapidbikes.co.uk
Posts: 9
|
|
PHP
Ok, here's the whole advertisement.php in a .txt file
http://www.rapidbikes.com/advertisement.txt
if you search for onclick you will find the section easier.
thanks for your help
Matt
|

10-02-2004, 04:33 PM
|
|
WebProWorld Pro
|
|
Join Date: May 2004
Location: United Kingdom
Posts: 176
|
|
Escape from " with \.
eg.$s="<a href=\"$picName\"
|

10-03-2004, 08:27 AM
|
|
WebProWorld New Member
|
|
Join Date: Apr 2004
Location: www.rapidbikes.co.uk
Posts: 9
|
|
PHP
Thank you sooooooo much
problem solved
much appreciated
Matt
|

10-04-2004, 02:20 PM
|
|
WebProWorld Pro
|
|
Join Date: May 2004
Location: United Kingdom
Posts: 176
|
|
You would have had it solved alot sooner if people who knew what they were doing replied only. Escaping is one of the very basic rules of php syntax. Anyone with the slightest clue about php coding would have answered your query easily, from the very first snippet you posted. Evevryone thinks they know everything in site and backend development.
|

10-06-2004, 01:36 PM
|
|
WebProWorld Pro
|
|
Join Date: Aug 2004
Location: Maryland
Posts: 219
|
|
Link code in PHP page
How can I get it to work if it's in a php page? Looks like this:
$htmlwebsite = '<a href<>\\'.$website.'\\>'.$website.'</a>';
The browser treats it like a relative url when it's an absolute url. Take out the <> and put = in it's place.
Instead of going to (example): www.webproworld.com it goes to www.kaytrimbath.com/www.webproworld.com
|

10-06-2004, 02:24 PM
|
|
WebProWorld Pro
|
|
Join Date: May 2004
Location: United Kingdom
Posts: 176
|
|
With a correct escape. Try reading up on syntax in the manual. You can even download your own free copy. More satisfying to solve it yourself than mooching forums for the answer surely.
And Ive never seen anything like this. Did you make it up or did someone give you it.
Code:
$htmlwebsite = '<a href<>\\'.$website.'\\>'.$website.'';
Below should be correct
Code:
$htmlwebsite = "<a href=\"".$website.">".$website."</a>";
Also use the editor code wrappers as this bb will not always correctly display your code.[/code]
|

10-06-2004, 05:38 PM
|
|
WebProWorld Pro
|
|
Join Date: Aug 2004
Location: Maryland
Posts: 219
|
|
Getting there, thanks php~pro
Well, I got it down to this now. That takes me out of my pretected area and to my root directory, but no matter how name ../ I put in, it only gets me to my root.
echo '<a href<>"../',$web,'">'.$web.'</a>';
Again, take out the <> and put = instead.
Oh, yeah, I made it up. That's why it looks funny, but it kinda works. I am going to paste everything after my database connection:
mysql_connect("localhost",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM business";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$company=mysql_result($result,$i,"company");
$house=mysql_result($result,$i,"house");
$street=mysql_result($result,$i,"street");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
echo "$first $last
$company
$house $street
$city, $state $zip
Phone: $phone
Mobile: $mobile
Fax: $fax
";
echo '<a href<>"mailto:',$email,'">'.$email.'</a>
';
echo '<a href<>"../',$web,'">'.$web.'</a>';
$i++;
}
?>
That still makes the url look like w3.kaytrimbath.com/w3.google.com
Instead of w3.google.com
But the email works great.
|

10-08-2004, 10:31 AM
|
|
WebProWorld Member
|
|
Join Date: Oct 2003
Location: St. Louis
Posts: 30
|
|
I'm guessing that you just have that web variable comes out like this $web="www.google.com";
You have this
echo '<a href<>"../',$web,'">'.$web.'';
You need this
echo '<a href = "http://'.$web.'">'.$web.'</a>';
Remember for absolute links you need the http://
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|