Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 4th, 2005, 12:38 PM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 50 m 39 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Newbie with PHP issue

Ok, so I'm teaching myself a bit of PHP (Webmonkey) to ease the efforts of multiple static pages. I understood how to do the "transfer" of the variable input by a user into a text box, to a new PHP page and "printed" into the HTML .
I tried to take it a step further and send a coding variable to a page and have the variable be the file name for an image(thumbnails to full images). In the body of the first page I had:
Code:
<form action="newPage.php" method=post>
          <?php
          $design="des01.png"
          ?>

          <input type="image" src="thumb.jpg" name=submit></form>


Then in the new page:
Code:
<?php
                print ("<img src=\"designs/$design\">"
                ?>

The goal was to have the outcome as <img src="designs/des01.png">

I got the new page with out the image. The directory was there but it doesn't seem to be getting the value of the variable (<img src="designs/">). Can you tell me where I'm missing whatever it is that keeps the information from being sent/received? Maybe the form is not neccessary?

Thanks (the actual code is not in front of me right now, but I'm fairly certain it's what I tried, well, one of the many variations). Any help is appreciated.
-Jim

Reply With Quote
  #2  
Old March 4th, 2005, 12:57 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,181 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced Folder
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 19 m 32 sec
Reputation Power: 699
hi,

the $design is not assigned as a global variable, so it wont get posted from page to page, you can however create a hidden field, with the value of $design and $_Post['HiddenFieldName']; on the other page.

try this

Code:
 page1:
 <form action="newPage.php" method=post>
 		  <?php
 		  $design="des01.png"
 		  ?>
 
 	<input type="hidden" name="design" value="<?echo $design;?>">
 		  <input type="image" src="thumb.jpg" name=submit>
 </form>
 
 ---newPage.php
 
 $design = $_POST['design'];
 
 print ("<img src=""designs/".$design."">")
 


hope this helps
__________________
Look! Its a ShemZilla



Reply With Quote
  #3  
Old March 4th, 2005, 01:03 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
the form doesn't post data to the next page unless it is in an input field. You could do that like this:
Code:
 <form action="newPage.php" method="post">
 <?php $design="des01.png"; ?>
 <input type="hidden" name="design" value="<?=$design;?>" />
 <input type="image" src="thumb.jpg" name="submit" />
 </form>
 


then on the next page:
Code:
 <?php
 echo ("<img src=\"designs/" . $_POST["design"] . "\">";
 ?>
 


good luck!
__________________
ShepherdWeb :: Charging Rhino Wizard

I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor.
{Henry David Thoreau}

§ shepherdweb.com
§ fariswheel productions
§ reagan administration

Reply With Quote
  #4  
Old March 4th, 2005, 01:04 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
Quote:
Originally Posted by nofriends
hi,

the $design is not assigned as a global variable, so it wont get posted from page to page, you can however create a hidden field, with the value of $design and $_Post['HiddenFieldName']; on the other page.

try this

Code:
  page1:
  <form action="newPage.php" method=post>
  		  <?php
  		  $design="des01.png"
  		  ?>
  
  	<input type="hidden" name="design" value="<?echo $design;?>">
  		  <input type="image" src="thumb.jpg" name=submit>
  </form>
  
  ---newPage.php
  
  $design = $_POST['design'];
  
  print ("<img src=""designs/".$design."">")
  


hope this helps


good answer...you beat me to the punch.

Reply With Quote
  #5  
Old March 4th, 2005, 01:21 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,181 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced FolderFolding Points: 98259 Folding Title: Advanced Folder
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 19 m 32 sec
Reputation Power: 699
same to you

kick %ss avatar, glad to see that you can finally have one

Reply With Quote
  #6  
Old March 4th, 2005, 02:42 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
Quote:
Originally Posted by nofriends
same to you

kick %ss avatar, glad to see that you can finally have one


THANKS!

Reply With Quote
  #7  
Old March 4th, 2005, 04:48 PM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 50 m 39 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Hmmm, neither work. Maybe I need to keep reading, but hopefully I won't get hung up. Just seemed simple enough and both codes look like it makes sense. The second page just comes up blank (white screen).

Reply With Quote
  #8  
Old March 4th, 2005, 11:03 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
Quote:
Originally Posted by OneRedLT4
Hmmm, neither work. Maybe I need to keep reading, but hopefully I won't get hung up. Just seemed simple enough and both codes look like it makes sense. The second page just comes up blank (white screen).


Do a "view source" and see what the code looks like underneath that blank white screen.

Reply With Quote
  #9  
Old March 5th, 2005, 05:35 AM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 50 m 39 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
I did that, and there was nothing between the body tags. I did, however, get it to work. I mixed what I was doing originally, and what you suggested with the hidden input. First page code is:

Code:
<form action="/designs/des01.php" method="post">
					<?php 
						$design="des12.jpg"
					 ?>
					 <?php 
						$label="Design 12"
					 ?>
					 	<input type="hidden" name="label" value="<?=$label;?>" /> 
						<input type="hidden" name="design" value="<?=$design;?>" /> 
 					<input name=submit type="image" src="images28/des12.jpg" width="175" height="160">
				</form>


and the receiving page:

Code:
<?php
			  	print $label
			  ?>
			  </p>
	    <br><br><br><center>
		<?php
 				print ("<img src=\"$design\">")
 		?>


I noticed when I tried to put set the two variables within the same PHP tags, I got the white screen. You can't just stick them all in there like other languages???

Thanks for the assistance. Can't wait to keep moving forward with this stuff!

-Jim
Comments on this post
banker agrees: props for returning and posting your solution!

Reply With Quote
  #10  
Old March 7th, 2005, 10:03 AM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
Way to go! Good luck!

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Newbie with PHP issue


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |