Jump to content

Is There Anyway To Accept User Input And Then Check It With Exisitng Data To And Return Appropriate Data ?


zenmind

Recommended Posts

Preface: I again apologize in advance earlier to the people who thought I was writing a Scam PHP page. I should have informed it was a teacher written assignment.

 

Hi guys so Im writing these two php webpages :

 

one is a signup page which is a mock 'dating site' :

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>NerdLuv</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link href="heart.gif" type="image/gif" rel="shortcut icon" />
<link href="nerdluv.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="main">
<div id="bannerarea">
<img src="nerdluv.png" alt="banner logo" /> <br />
where meek geeks meet
</div>

<div id="matches">
<h1>Matches for User Name</h1>
<div class="match">
 <p class="name">
 <img src="images/ada_lovelace.jpg" alt="Ada Lovelace" />
 Ada Lovelace
 </p>
 <p class="info">
 <strong>gender:</strong> F <br />
 <strong>age:</strong>	 96 <br />
 <strong>type:</strong> ISTJ <br />
 <strong>OS:</strong>	 Linux <br />
 <strong>rating:</strong> 4
 </p>
</div> <!--End of first match case ada lovelace -->

<div class="match">
 <p class="name">
		 <img src="images/grace_hopper.jpg" alt="Grace Hopper" />
		 Grace Hopper
	 </p>
 <p class="info">
 <strong>gender:</strong> F <br />
 <strong>age:</strong>	 87 <br />
 <strong>type:</strong> ISFP <br />
 <strong>OS:</strong>	 Windows <br />
 <strong>rating:</strong> 4
 </p>
</div> <!-- end of second match case -->

</div> <!-- Div id matches-->

 <!--This reads the singles text file and prints them to the results page -->
<!--<?php include("singles.txt");
?> -->
<p>

</p>
<div id="w3c">
<a href="http://validator.w3.org/check/referer">
<img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS" /></a>
</div>
</body>
</html>

 

 

the other is a results page which will display the appropriate match according to user input :

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR...D/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>NerdLuv</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link href="heart.gif" type="image/gif" rel="shortcut icon" />
<link href="nerdluv.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="main">
<div id="bannerarea">
<img src="nerdluv.png" alt="banner logo" /> <br />
where meek geeks meet
</div>
<div id="matches">
<h1>Matches for User Name</h1>
<div class="match">
<p class="name">
<img src="images/ada_lovelace.jpg" alt="Ada Lovelace" />
Ada Lovelace
</p>
<p class="info">
<strong>gender:</strong> F <br />
<strong>age:</strong>	 96 <br />
<strong>type:</strong> ISTJ <br />
<strong>OS:</strong>	 Linux <br />
<strong>rating:</strong> 4
</p>
</div> <!--End of first match case ada lovelace -->

<div class="match">
<p class="name">
 <img src="images/grace_hopper.jpg" alt="Grace Hopper" />
 Grace Hopper
</p>
<p class="info">
<strong>gender:</strong> F <br />
<strong>age:</strong>	 87 <br />
<strong>type:</strong> ISFP <br />
<strong>OS:</strong>	 Windows <br />
<strong>rating:</strong> 4
</p>
</div> <!-- end of second match case -->
</div> <!-- Div id matches-->

<!--This reads the singles text file and prints them to the results page -->
<!--<?php include("singles.txt");
?> -->
<p>
</p>
<div id="w3c">
<a href="http://validator.w3....check/referer">
<img src="http://www.w3.org/Ic.../valid-xhtml11" alt="Valid XHTML 1.1" /></a>
<a href="http://jigsaw.w3.org...check/referer">
<img src="http://jigsaw.w3.org...or/images/vcss" alt="Valid CSS" /></a>
</div>
</body>
</html>

 

 

I was thinking ultimately to implement POST methods with a function to retrieve the data and POST but at this point Im totally lost......

If I just implement a form action post it will obviously need something on the other php page to recieve it . But thats not how its setup, ill need a way to send the user data have it check the data in a textfile(which is what results.php displays from, and also write the user data in the same file ) then once results.php processes it shows the "suitable" matches according to user input ..Im coming short in development time so any

help would be great..

 

Thanks

Edited by zenmind
Link to comment
Share on other sites

Maybe it is just me, but those two scripts look exactly the same. In any event I don't see a form in the signup page.

 

Take this ONE STEP at a time.

 

Here is something to get you started.:

1. Create a form for the user to enter their data.

2. Create a page to receive that form input. Start by just doing a print_r($_POST) to verify that the data you expect was actually submitted. Then start building the functionality that it will use that data for.

3. Create a process to read the data file. Don't do anything with it, just output it to the page to ensure you are reading it correctly.

4. Add a process at the end of the file reading steps to add the new record to the file based upon the user data

5. Update the above process to look for matches based upon what the user entered and display those

 

So, do one thing at a time. If you get stuck, show us what you have and explain what it IS doing and what it is SUPPOSED to be doing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.