Jump to content

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!
Link to comment
https://forums.phpfreaks.com/topic/17953-need-help-on-my-php-scripts/
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.
[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.
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... ;)
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; ?>
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?



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>
--------
[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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.