Jump to content


Photo

need help on my php scripts


  • Please log in to reply
19 replies to this topic

#1 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 03:14 PM

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!

#2 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 03:20 PM

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.
+++++

#3 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 18 August 2006 - 03:24 PM

Perhaps posting the code from your products.php will get us on the right track to helping you figure out your issue... ;)

#4 foreverhex

foreverhex
  • Members
  • PipPipPip
  • Advanced Member
  • 91 posts

Posted 18 August 2006 - 03:26 PM

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.

#5 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 03:28 PM

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!

#6 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 18 August 2006 - 03:34 PM

http://www.sinagtala.net/eric/ gives out a pre-parsed copy of products.php.

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

#7 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 03:37 PM

i've made a copy of my products.php in
http://www.sinagtala.net/eric/
please check

thanks!

#8 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 18 August 2006 - 03:42 PM

We need to see some code

use http://pastebin.com/ and tell use the link
Tell me the problem, I will try tell you the solution

#9 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 03:52 PM

here is my products.php scripts

http://www.sinagtala...c/products.phps

#10 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 18 August 2006 - 03:58 PM

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:

info.php
<?php

// Show all PHP information
phpinfo();

?>

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... ;)

#11 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 04:10 PM

hi,
http://www.sinagtala.net/info.php
from here its telling me that the register global is "off"

what will i do with this?



#12 Cell0518

Cell0518
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts
  • LocationUSA / Japan (US Navy)

Posted 18 August 2006 - 04:16 PM

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 ->
<td width="520" rowspan="3" bgcolor="#E7E7DD" valign="top"><iframe id="productmain" src="<?=$url;?>".....

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

#13 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 05:51 PM

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!


#14 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 18 August 2006 - 06:31 PM

Any variables that you pass through the URL (example: http://www.yoursite....r1=foo&var2=bar), you will access from the $_GET array:

<?php

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

?>


#15 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 07:45 PM

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?





#16 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 18 August 2006 - 07:56 PM

its a mess ;)

use switch....

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

is that script from what should be in the iframe?

follow me on twitter @PHPsycho

#17 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 07:57 PM

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>
--------

#18 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 08:03 PM

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.../eric/news.phps

#19 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 18 August 2006 - 08:16 PM

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

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

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

... or to save space ...

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


#20 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 18 August 2006 - 10:41 PM

thank bro!

it worked!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users