Webdetector Webmaster Forums - Your favorite webmaster community
 
  #1 (permalink)  
Old 06-14-2008, 02:18 AM
Member
Marketeer
 
Join Date: May 2008
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Google Adsense question

i want to insert values in to a array in one page using a while loop. i dnt know how many vlaues will be ienterd so i used the following code:

Code:
<? $name=array();
$i=0;
while ($val2=mysql_fetch_array($result2)) {
$name[$i]=$val2["s_id"];
$i=$i+1;
echo($name[$i]);
}

then i passed this array to anothr page like this:
$name=urlencode(serialize
($name));
?><input name="names" type="hidden"
id="names" value="<? $name ?>">

on the nex page i said:
$name=unserialize(urldecode
($_REQUEST["names"]));
if(!empty($name)){
echo($name[0]);
}
else {
echo("no value");
}
Problem: it dnt return any value sn the 2n page and on the 1st pae gives this error: -
Undefined offset: 1 on the line having - echo($name[$i]); on the first page.

Please HELP!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)  
Old 06-14-2008, 08:54 PM
Member
noobee
 
Join Date: May 2008
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Blogger page shows adsense works and fine, The bought domain for the same page. No ad

Well on the first page, you increase the value of $i before you echo out the name. Place $i=$i+1; after the last echo. Additionally you can replace ($i=$i+1;) with ($i++;)

For the second page, make sure the form where you have the input is not method=post, if it is, change $_REQUEST on the last page to $_POST.

Hope that helps. Message me if you still have issues.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-15-2008, 03:30 PM
Super Moderator
noobee
 
Join Date: Jun 2008
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default What are the most searched types of websites?

Undefined offset - you should increment your counter $i last. echo(...) should come before $i=$i+1.

Passing large amounts of data between pages is not a good idea. To use your method, make sure you are using a form for your inputs.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 12:11 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Ad Management by RedTyger