Jump to content

Archived

This topic is now archived and is closed to further replies.

pixeltrace

need help on my php scripts

Recommended Posts

guys,

i need help on this.
please check my products page
http://www.sinagtala.net/

try clicking the product button or services button on the right panel
notice that it will redirect you to the default page of my iframe which is prodall.php

try clicking the product button and on the select category (all products, paintings, cds, books)
notice that it will also redirect you to the default page of my iframe

this was working before before my webhosting migrate my site to another server.
no changes in the php version and sql.


hope you guys can help me on this.

thanks in advance!

Share this post


Link to post
Share on other sites
products page

http://www.sinagtala.net/products.php

+++++
how can i attached my products page?
its giving me a page error
"page cannot be displayed"
whenever i am attaching my scripts here.
+++++

Share this post


Link to post
Share on other sites
Perhaps posting the code from your [b]products.php[/b] will get us on the right track to helping you figure out your issue... ;)

Share this post


Link to post
Share on other sites
So I think its something wrong with your SQL query. If this is in fact how you do your page. Also I noticed your Order now links are bad. They say something like (porder.php?$product_name=Pasig, River of Life) and that all seems wierd to me, you need to get rid of the $ in your product_name.

Share this post


Link to post
Share on other sites
sorry for the hassle.

my products page can be downloaded here
http://www.sinagtala.net/eric/

hope you guys can help me with this

i just need to fix it asap

thanks in advance!

Share this post


Link to post
Share on other sites
[url=http://www.sinagtala.net/eric/]http://www.sinagtala.net/eric/[/url] gives out a pre-parsed copy of [b]products.php[/b].

Make a copy of your [b]products.php[/b] in the same folder mentioned above, but with a [b].phps[/b] extension, or just paste the code from your [b]products.php[/b] file here and we'll take a look at it.

Share this post


Link to post
Share on other sites
We need to see some code

use http://pastebin.com/ and tell use the link

Share this post


Link to post
Share on other sites
Allright, I'm seeing the use of variables that are only assigned if RegisterGlobals is turned on in your php.ini file. Your new web host may not have this option enabled by default.

Create and run the following script:

[b]info.php[/b]
[code]
<?php

// Show all PHP information
phpinfo();

?>
[/code]

Look for entries regarding Register Globals, if they are set to "1", your problem lies elsewhere. If they are set to "0", then you need to make some changes to your variables.

Let us know what you find out... ;)

Share this post


Link to post
Share on other sites
hi,
http://www.sinagtala.net/info.php
from here its telling me that the register global is "off"

what will i do with this?

Share this post


Link to post
Share on other sites
Register Globals is off.

1.  you need to place $varname = $_GET["varname"] for php to look for the variable passed in the url.

*( place the code before the variable is used )*

Example:

$product = $_GET["product"];
echo $product;

2.  Check this line -> [code]<td width="520" rowspan="3" bgcolor="#E7E7DD" valign="top"><iframe id="productmain" src="<?=$url;?>".....[/code]

replace <?=$url;?> with either <? echo $url; ?> or <? print $url; ?>

Share this post


Link to post
Share on other sites
hey,

the echo or print worked

but for the $_GET, i dont have an idea how to use it.
could you give me an example on my page?

thanks!

Share this post


Link to post
Share on other sites
Any variables that you pass through the URL (example: http://www.yoursite.com/yourpage.php?var1=foo&var2=bar), you will access from the $_GET array:

[code]
<?php

$var1 = $_GET['var1']; // $var1 equals "foo"
$var2 = $_GET['var2']; // $var2 equals "bar"

?>
[/code]

Share this post


Link to post
Share on other sites
hey,

it worked for my right panel
but for my iframe its still not working

here is the php script from my first line
-----------
<?
if (!isset($url)) { $url='news/upcoming.php';}
  ?>
-----------
the script of my iframe
-----------
<iframe id="newsmain" name="newsmain" src="<?=$url;?>" width=499 height=425 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=yes></iframe> </td>
-----------
the script of my $_GET
-----------
<?
$id = $_GET['id'];
{
$side = 'news/upcomingside.php';
if ($id == '1') {$side = 'news/upcomingside.php';}
if ($id == '1') {$url = 'news/upcoming.php';}
if ($id == '2') {$side = 'news/eventside.php';}
if ($id == '2') {$url = 'news/events.php';}
if ($id == '3') {$side = 'news/recommendside.php';}
if ($id == '3') {$url = 'news/recommends.php';}
if ($id == '4') {$side = 'news/upcomingside.php';}
if ($id == '4') {$url = 'news/hot.php';}
if ($id == '5') {$side = 'news/eventside.php';}
if ($id == '5') {$url = 'news/pastevents.php';}
if ($id == '6') {$side = 'news/eventside.php';}
if ($id == '6') {$url = 'news/privateevents.php';}
if ($id == '7') {$side = 'news/eventside.php';}
if ($id == '7') {$url = 'news/tourevents.php';}
if ($id == '8') {$side = 'news/eventside.php';}
if ($id == '8') {$url = 'news/sponsoredevents.php';}
if ($id == '9') {$side = 'news/eventside.php';}
if ($id == '9') {$url = 'news/corporateevents.php';}
if ($id == '10') {$url = 'news/newsinq.php';}
} ?>                          <? include ($side); ?>
-----------

whats wrong with my script?



Share this post


Link to post
Share on other sites
its a mess ;)

use switch....

also use <?php echo $url; ?> instead just incase....

is that script from what should be in the iframe?

Share this post


Link to post
Share on other sites
by the way, that script is for my news page
http://www.sinagtala.net/news.php

for products page
everything is working fine.
except for the select category section.
if you click any of the catergories (all products, painting, cds, books)
it will just point you to the allproducst page which is prodall.php
--------
also, here is the script of my select category section
--------
<form method="POST" style="margin:0" name="form" action="products/prodall.php">
<table width="135" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                           <td colspan="2" align="left"><img src="images/productcategory.gif" width="206" height="24"></td>
                           </tr>
                         <tr>
                           <td width="30" rowspan="3" align="left"><img src="images/productbar3.gif" width="30" height="75"></td>
                           <td width="176" valign="top"><img src="images/spacer.gif" width="10" height="10"/></td>
                         </tr>
                         <tr>
                           <td align="right" valign="top">
<span class="bodytext1">select category</span>
<select class="sorteventlist" name="list" onFocus="selectedIndex = 0" onChange="if( options[selectedIndex].value != '') document.location = 'products.php?url='+form.list.value">
                            <option value="javascript:;">------------</option>
                               <option value="products/prodall.php">ALL PRODUCTS</option>
                               <option value="products/cd.php">AUDIO CDS</option>
                               <option value="products/painting.php">PAINTINGS</option>
                               <option value="products/book.php">BOOKS</option>
                           </select></td>
                         </tr>
                         <tr>
                           <td>&nbsp;</td>
                         </tr>
                       </table></form>
--------

Share this post


Link to post
Share on other sites
sorry about the mess,
im just really not good at this yet.
this is the script by the way of my news page
--------
http://www.sinagtala.net/eric/news.phps

Share this post


Link to post
Share on other sites
[code]
<?
if (!isset($url)) { $url='products/prodall.php';}
  ?>
[/code]

Again, with Register Globals off, you [b]must[/b] pull all of your variables from the URL by way of the $_GET array. Change the above line to read:

[code]
<?php
if (!isset($_GET['url'])){
  $url='products/prodall.php';
} else {
  $url = $_GET['url'];
}
?>
[/code]

... or to save space ...

[code]
<?php
$url = (!isset($_GET['url'])) ? $_GET['url'] : "products/prodall.php";
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.