some advice
Moderator: General Moderators
some advice
I'm new to php and so far the only reference to using php that i've seen is the echo tag. No matter how complicated coding gets it all points to a simple echo to print some result of some information. My question is how do i use php to display a file in a table. for example i make a form in html. The form has a table in which u can browse for a photo, then using the submit button, sending that photo to a table in the index.php for instance. what do i use then to get the info from the submit to the php page. I read a little bit about the file codes in php and am unsure if i should use a temp file command of some sort, but how would i keep the integrity of the php page that way, wouldn't the info just change everytime the temp dir was cleared, etc... I'm totally unsure how to go about coding this any pointers would be welcome.
reply
A quick tutorial is in order.
http://www.devshed.com/php/
look for a article called php 101
it should take about an hour.
Books are better to learn from though.
also you can look at http://www.php.net put fopen in the search/functionlist for some examples of file handling
.
http://www.devshed.com/php/
look for a article called php 101
it should take about an hour.
Books are better to learn from though.
also you can look at http://www.php.net put fopen in the search/functionlist for some examples of file handling
.
If I understand you at all I would suggest:
You have your form with some selection box or something that uses JS to change images and the like:
Then index.php you have:
Is that what you meant at all?
You have your form with some selection box or something that uses JS to change images and the like:
Code: Select all
<form action="index.php" method="post">
<select name="image">
<option value="img1.jpg">Image 1</option>
<option value="img2.jpg">Image 2</option>
</select>
</form>Code: Select all
<?php
echo "<table>
<tr>
<td><img src="$image">
</td>
</tr>
</table>";
?>Not quite
No what i'm trying to do is make a template that my dad can browse a file on his computer preferably images, then on the submit button it would go to index.php and show up in a table. its a basic template for him to make a photo web page, i just can't figure out the coding for the php i have the form working fine.
That won't work.gotDNS wrote: <?php
echo "<table>
<tr>
<td><img src="$image">
</td>
</tr>
</table>";
?>
Code: Select all
<?php
echo "
<TABLE>
<TR>
<TD>
<IMG SRC="$image">
</TD>
</TR>
</TABLE>
";
?>- James Pelow
- Site Admin
- Posts: 51
- Joined: Sat Jun 01, 2002 5:28 am
- Location: Killiney, Co. Dublin, Ireland
- Contact:
PHP 4.2.x and Request Variables
Tut tut tut.... what about PHP 4.2.x? None of them will work!
-James
Code: Select all
<?php
echo "
<TABLE>
<TR>
<TD>
<IMG SRC="" . $_POSTї"image"] . "">
</TD>
</TR>
</TABLE>
";
?>i have images
... http://brin.ath.cx/images/
What i have
this is the form:
<center><table cellpadding=0 cellspacing=30 border=1>
<tr><td align=center valign=bottom>
<form method=get enctype="multipart/form-data" name="photo1" action="http://spork/scripts/index.php">
<input type="hidden" name="directory1" value="">
<input type="hidden" NAME="dispopts1" VALUE="html, gif, jpg, other;;*">
<input type="file" name="userfile1" size=15><br>
<input type="submit" NAME="op-upload1" value="Get File"> <br>
</form></td>
now is there a way to capture the file path into the php document from this form? if i specify $userfile1 in the php i know theres a way to get that path. and post the image.
<center><table cellpadding=0 cellspacing=30 border=1>
<tr><td align=center valign=bottom>
<form method=get enctype="multipart/form-data" name="photo1" action="http://spork/scripts/index.php">
<input type="hidden" name="directory1" value="">
<input type="hidden" NAME="dispopts1" VALUE="html, gif, jpg, other;;*">
<input type="file" name="userfile1" size=15><br>
<input type="submit" NAME="op-upload1" value="Get File"> <br>
</form></td>
now is there a way to capture the file path into the php document from this form? if i specify $userfile1 in the php i know theres a way to get that path. and post the image.