PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

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 Dev Shed Forums Sponsor:
  #1  
Old December 17th, 2012, 02:12 AM
antkan antkan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 antkan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 51 sec
Reputation Power: 0
Html read php variables

I make a simple temrerature.php file into my webserver with $temp="25"; simple variable.How i can display this variable into my intex.html file?I try this
Code:
<td><input type="text" size="4" value="<?temperature.php echo $temp; ?>"/></td>
but no work....My site support php.

Reply With Quote
  #2  
Old December 17th, 2012, 02:16 AM
aeternus's Avatar
aeternus aeternus is offline
For POny!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Amsterdam
Posts: 416 aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 4 h 56 m 43 sec
Reputation Power: 114
you forgot the name=" " attribute btw

Code:

<input type="text" name="somefield" value="<?php echo $temp; ?>"  />

Also notice the php tags (if temperature.php is a different file you need to include it)
__________________
PHP Tutorial

Last edited by aeternus : December 17th, 2012 at 02:19 AM.

Reply With Quote
  #3  
Old December 17th, 2012, 02:27 AM
antkan antkan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 antkan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 51 sec
Reputation Power: 0
I try it but no work...i try and this...
Code:
Temperature is: <?temperature.php echo $_GET["temp"]; ?>.<br>
...but no work...For save data work...i use this
Code:
<form name="delay" method="post" action="delay.php">  Input delay time seconds: <input type="text" name="sec" value=""  size="4" maxlength="4">
.Where is my mistake?

Reply With Quote
  #4  
Old December 17th, 2012, 03:01 AM
aeternus's Avatar
aeternus aeternus is offline
For POny!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Amsterdam
Posts: 416 aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 4 h 56 m 43 sec
Reputation Power: 114
Quote:
Originally Posted by antkan
I try it but no work...i try and this...
Code:
Temperature is: <?temperature.php echo $_GET["temp"]; ?>.<br>
...but no work...For save data work...i use this
Code:
<form name="delay" method="post" action="delay.php">  Input delay time seconds: <input type="text" name="sec" value=""  size="4" maxlength="4">
.Where is my mistake?


Did you read the link??

this is wrong (already mentioned it):
<?temperature.php
should be <?php

Reply With Quote
  #5  
Old December 17th, 2012, 03:34 AM
antkan antkan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 antkan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 51 sec
Reputation Power: 0
I test this...inside my html index.html
Code:
<td><input type="text"  name="somefield"  size="4" value="<?php include 'temp.php';  echo $temp;  ?>"/></td>


temp.php

<?php
$temp="25";
?>

but no work....

Reply With Quote
  #6  
Old December 17th, 2012, 03:49 AM
aeternus's Avatar
aeternus aeternus is offline
For POny!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Amsterdam
Posts: 416 aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 4 h 56 m 43 sec
Reputation Power: 114
Any errors?
(if you are testing place this above all your scripts)
PHP Code:
<?php
ini_set
('display_errors',1); 
 
error_reporting(E_ALL);

?>


Make sure in your case that the 2 files are in the same directory
Btw it is probably a better Idea to include the file at the top of your script to keep it more organized

Last edited by aeternus : December 17th, 2012 at 03:55 AM.

Reply With Quote
  #7  
Old December 17th, 2012, 05:03 AM
antkan antkan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 antkan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 51 sec
Reputation Power: 0
I try this code....
Code:
<html>   <head>     <title>Untitled</title>   </head>   <body>  <?php ini_set('display_errors',1);   error_reporting(E_ALL); echo "hello"; ?>    </body> </html>


but no display anything...
Host optios are...
Php support is on,
Allow web users to use scripts is on but
Apache ASP support is off....

when load mysite/temp.php

with this code
Code:
<?php $temp = "23";  echo $temp;  ?>


display data 23

Reply With Quote
  #8  
Old December 17th, 2012, 05:13 AM
aeternus's Avatar
aeternus aeternus is offline
For POny!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Amsterdam
Posts: 416 aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 4 h 56 m 43 sec
Reputation Power: 114
OK lets start with the basics. Skipp your code and do the following nothing more nothing les.

Make a file in notepad and call it test.php Put in that code the following. Upload it and run it.

PHP Code:
<?php

echo 'hello world';

$variable 'this is a variable';

echo 
$variable;

?>


Does that work? Do you have a book or something about php?

Reply With Quote
  #9  
Old December 17th, 2012, 05:23 AM
antkan antkan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 antkan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 51 sec
Reputation Power: 0
Yes work and print hello worldthis is a variable but i want to display my variable from php file to index.html

Reply With Quote
  #10  
Old December 17th, 2012, 05:26 AM
aeternus's Avatar
aeternus aeternus is offline
For POny!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Amsterdam
Posts: 416 aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 4 h 56 m 43 sec
Reputation Power: 114
Quote:
Originally Posted by antkan
Yes work and print hello worldthis is a variable but i want to display my variable from php file to index.html

EXACTLY!~ but you can't because the file should be named .php for your server to process it as php. (unless you mess around with some server settings which i recommend you don't)

So rename all files you have that you would like to include php in to .php (so with a .php extension instead of a .html one)

You might want to get a decent book instead of online tutorials. books tend to start at the beginning .

Last edited by aeternus : December 17th, 2012 at 05:29 AM.

Reply With Quote
  #11  
Old December 17th, 2012, 05:31 AM
antkan antkan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 antkan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 51 sec
Reputation Power: 0
Ok.I understand i must make index.php.I want to make an apk to my android to upload a simple variable temperature....and read from client.It is possible for auto refresh if receive web server the data?Any advise?What type file must upload for my variable temperature .php .txt?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Html read php variables

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap