LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-22-2005, 04:07 PM   #1
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 438

Rep: Reputation: 30
html to php? help me please!!!!!


hi im trying to write a html file that passes the information from a text field called query to a php page, that will store the information in a text file.
i have tried for hrs, using some code that one of my lectures gave me, but it doesnt seem to work? can any one help please?
 
Old 01-22-2005, 04:18 PM   #2
tamoneya
Member
 
Registered: Jan 2005
Location: MA
Distribution: Ubuntu 7.10
Posts: 558

Rep: Reputation: 30
post the code using the code button so that we can take a look at it. In general it is always much easier to solve a prblem once you know more about it.
 
Old 01-23-2005, 07:38 AM   #3
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 438

Original Poster
Rep: Reputation: 30
this is the html code:

<html>
<head>
<title>Student Search Engine</title>
</head>
<body>
<table width="800" border="0">

<tr>
<td width="600"><font size="13">
<div align="center"><b>Query</b></div>
</font>
<form name="form1" method="post" action="./file13.php">
<div align="center">
<input type="text" name="query" maxlength="30"></div>
</form></td>
<script type="text/javascript">
document.form1.query.focus();
</script>
<td width="200"><div align="left">Advanced Options;</div>
<form method="post" action="file13.php">
<input type="radio" name="operation" value="radiobutton" checked>
AND<br>
<input type="radio" name="operation" value="radiobutton">
OR
</form></td>
</tr>

<tr></tr>
<tr>
<td><div align="center">
<form method="post" action="file13.php">
<select name="site">
<option>Google</option>
<option>Voyager</option>
<option>ScienceDirect</option>
</select>
</form>
</div></td>
<tag><td>&nbsp;</td></tag?>
</tr>
<tr>
<td><form method="post" action="file13.php">
<div align="center">
<input type="submit" name="Submit" value="submit">
</div>
</form></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>



and this is the php:

<html>
<head><title></title></head>
<body>
<?php
echo "Searhing For ".$_POST['query'];
echo "Searhing For ".$_POST['operation'];
echo "Searhing For ".$_POST['site'];
?>
</body>
</html>




im trying to store the variables into a text file. i would of posted earlier but we had quite a savage power cut!!! things arnt looking up. ;(
cheers for your help!!!
 
Old 01-23-2005, 09:13 AM   #4
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Rep: Reputation: 30
Hi there,

Add something like:
Code:
<?php

$fd = fopen( "myFile.txt", "a" );
fputs( $fd, $_POST['query'] );
fputs( $fd, $_POST['operation'] );
fputs( $fd, $_POST['site'] );
fclose( $fd );

?>

fopen() opens a file, here it is in append mode so it will add to the bottom of the file. If you called
Code:
fopen( "myfile.txt", "w" );
it would be opened for write, and the current contents of the file would be erased.

HTH.
 
Old 01-24-2005, 07:36 AM   #5
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 438

Original Poster
Rep: Reputation: 30
you legend!! thank you so much for your help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
html into php charnel Programming 7 08-30-2005 11:47 AM
HTML fighting PHP aciesd Linux - Software 3 07-16-2005 09:05 AM
HTML/PHP question perfect_circle Programming 2 04-22-2005 12:42 PM
php/html editor dai Linux - Software 10 03-10-2003 05:34 PM
frames in html and php ranixlb Programming 3 12-04-2002 01:58 AM


All times are GMT -5. The time now is 04:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration