Jump to content

search page


uaeustudent

Recommended Posts

Hi all;

I am working in php cade. I have page to insert information, and other page include button linked to that page. But it should contain the information which was inserted.

This is my code " they are all in the same page"

 

PHP Code:

<?php

$host = "localhost";

$user = "";

$password = "";

 

$db = "job seeker";

$table = "personalinformation";

 

mysql_connect($host,$user,$password) or die("Failed to connect");

mysql_select_db($db) or die("Falied to select database");

 

$sql = "SELECT * FROM $table ORDER BY id ASC;";

$result = mysql_query($sql);

 

$id = $_GET["id"];

$sql = "SELECT * FROM $table WHERE id='$id'";

 

 

 

?>

 

HTML Code:

<html>

<html dir="rtl" xmlns:v="urn:schemas-microsoft-com:vml" xmlns="urn:schemas-microsoft-comfficeffice" xmlns="http://www.w3.org/TR/REC-html40">

 

<head>

 

 

</script>

 

<meta http-equiv="Content-Language" content="en-us">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

 

<title>Job Preference form</title>

</head>

 

<body onload="FP_preloadImgs(/*url*/'button26.jpg',/*url*/'button25.jpg',/*url*/'button1C.jpg',/*url*/'button1B.jpg',/*url*/'button19.jpg',/*url*/'button18.jpg',/*url*/'button2D.jpg',/*url*/'button2C.jpg')">

 

<form method="GET" action="db_insertPersonalInfo.php" onSubmit="return checkForm()" name="Form">

<p dir="ltr" align="center">     &nbsp ;        & nbsp;       &nb sp;       &nbsp ;        & nbsp;       &nb sp;       &nbsp ;    </p>

<p align="center"></p>

<p align="center"><a href="Skill.htm" target="bottom"></a><img border="0" src="1.jpg" width="984" height="72"></p>

<p> </p>

<table border="0" width="100%" id="table1">

<tr>

<td>

<p align="left"><b><font size="5">Personal Information form</font><span style="font-size: 12.0pt; font-family: Verdana; color: black">

</span></b></td>

</tr>

<tr>

<td>

<p align="left">

<input type="text" name="Address" size="20" value="$myrow[Address]">Address    </td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="City" size="20" value="$myrow[City]">City   </td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="PhoneNumber" size="20" value="$myrow[PhoneNumber]">PhoneNumber   </td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="Fax" size="20" value="$myrow[Fax]">Fax   </td>

</tr>

<tr>

<td>

<p align="left"><b><font size="5">Job Preference form</font></b></td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="Fax" size="20" value="$myrow[specialization]">Specialization   </td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="Fax" size="20" value="$myrow[TargetSalary]">TargetSalary   </td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="Fax" size="20" value="$myrow[JobType]">JobType   </td>

</tr>

<tr>

<td>

<p align="left"><span dir="LTR"></span><span style="font-size: 12.0pt; font-family: Times New Roman">

<input type="radio" value="$myrow[WillingToRelocate]" name="WillingToRelocate"> Willing to Relocate 

</span></td>

</tr>

</table>

<p> </p>

<p> </p>

<img border="0" id="img11" src="file:///D:/Documents%20and%20Settings/200401661/Local%20Settings/Temporary%20Internet%20Files/FrontPageTempDir/button2.jpg" height="20" width="100" alt="Next" onmouseover="FP_swapImg(1,0,/*id*/'img11',/*url*/'file:///D:/Documents%20and%20Settings/200401661/Local%20Settings/Temporary%20Internet%20Files/FrontPageTempDir/button3.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img11',/*url*/'file:///D:/Documents%20and%20Settings/200401661/Local%20Settings/Temporary%20Internet%20Files/FrontPageTempDir/button2.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img11',/*url*/'file:///D:/Documents%20and%20Settings/200401661/Local%20Settings/Temporary%20Internet%20Files/FrontPageTempDir/button4.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img11',/*url*/'file:///D:/Documents%20and%20Settings/200401661/Local%20Settings/Temporary%20Internet%20Files/FrontPageTempDir/button3.jpg')" fp-style="fp-btn: Braided Row 2" fp-title="Next" align="left">

</form>

<p align="left"> </p>

 

</body>

 

</head>

 

Link to comment
Share on other sites

A couple of things...

1. Your second $sql variable overwrites your first, and you should only have one query to make this call

"SELECT * FROM $table WHERE id=$id LIMIT 1"

 

2. You never run the query to the database..do

<?php
$query = "SELECT * FROM $table WHERE id=$id LIMIT 1";
$result = mysql_query($query) or die("problem with query: ".$query);
$row = mysql_fetch_array($result);
?>

 

3. You make calls to php variables inside your html. If you want do that, use this format <?=$row['address'];?>

Link to comment
Share on other sites

no differents really i just try not to use short_open_tag  as it can be turned off and then the code fails to parser

 

php.ini short_open_tag 

short_open_tag  boolean

 

    Tells whether the short form (<? ?>) of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use <?xml ?> inline. Otherwise, you can print it with PHP, for example: <?php echo '<?xml version="1.0"'; ?>. Also if disabled, you must use the long form of the PHP open tag (<?php ?>).

 

        Note: This directive also affects the shorthand <?=, which is identical to <? echo. Use of this shortcut requires short_open_tag to be on.

Link to comment
Share on other sites

1st open the page with pagename.php?id=id

pagename being the file name and id being the id number

 

2nd replace

$row[address];

with

<?=$row['address'];?>

in the HTML Code: section

NB: use the same idea as address for City

ie

$myrow[City]

to

<?=$row['City'];?>

Link to comment
Share on other sites

Sorry but I change the code but it doesnt work

The code

<html dir="rtl" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">

 

<head>

 

<meta http-equiv="Content-Language" content="en-us">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

 

<title>Job Preference form</title>

</head>

 

<body onload="FP_preloadImgs(/*url*/'button109.jpg', /*url*/'button110.jpg', /*url*/'button111.jpg', /*url*/'button112.jpg', /*url*/'button113.jpg', /*url*/'buttonD3.jpg', /*url*/'button117.jpg', /*url*/'button118.jpg')">

<?php

 

 

$host      = "localhost";

$user      = "";

$password  = "";

 

$db        = "job seeker";

$table    = "personalinformation";

?>

<p dir="ltr" align="center">                                                            </p>

<p align="center"></p>

<p align="center"><a href="Skill.htm" target="bottom">

<input style="visibility:hidden;"img border="0" id="img10" src="button119.jpg" height="26" width="130" alt="Skill" onmouseover="FP_swapImg(1,0,/*id*/'img10',/*url*/'button117.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img10',/*url*/'button119.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img10',/*url*/'button118.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img10',/*url*/'button117.jpg')" fp-style="fp-btn: Braided Row 2" fp-title="Skill"></a><a href="Workexperience.html" target="bottom"><input style="visibility:hidden;"img border="0" id="img9" src="button114.jpg" height="26" width="130" alt="Work Experince" onmouseover="FP_swapImg(1,0,/*id*/'img9',/*url*/'button113.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img9',/*url*/'button114.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img9',/*url*/'buttonD3.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img9',/*url*/'button113.jpg')" fp-style="fp-btn: Braided Row 2" fp-title="Work Experince"></a><a href="Education.htm"><input style="visibility:hidden;"img border="0" id="img7" src="button115.jpg" height="26" width="130" alt="Education" onmouseover="FP_swapImg(1,0,/*id*/'img7',/*url*/'button110.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img7',/*url*/'button115.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img7',/*url*/'button109.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img7',/*url*/'button110.jpg')" fp-style="fp-btn: Braided Row 2; fp-orig: 0" fp-title="Education"></a><a href="PersonalInfo.html" target="bottom"><img border="0" id="img8" src="button116.jpg" height="26" width="130" alt="Personal Information" onmouseover="FP_swapImg(1,0,/*id*/'img8',/*url*/'button111.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img8',/*url*/'button116.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img8',/*url*/'button112.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img8',/*url*/'button111.jpg')" fp-style="fp-btn: Braided Row 2" fp-title="Personal Information"></a><img border="0" src="1.jpg" width="984" height="72"></p>

<p> </p>

<table border="0" width="100%" id="table1">

<tr>

<td>

<p align="left">

<input type="hidden" name="id" size="20" value="$myrow[id]"></td>

</tr>

<tr>

<td>

<p align="left"><b><font size="5">Personal Information form</font><span style="font-size: 12.0pt; font-family: Verdana; color: black">

</span></b></td>

</tr>

<tr>

<td>

<p align="left">

<input type="text" name="Address" size = "20">Addres    </td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="City" size="20" >City   </td>

</tr>

<tr>

<td>

<p align="left"><input type="text" name="Fax" size="20">Fax   </td>

</tr>

<tr>

<td>

<p align="left"><b><font size="5">Job Preference form</font></b></td>

</tr>

        <tr>

<td>

<p align="left"><select size="1" name="Specialization">

<option>

select-------------------------------------------------------

</option>

<option value="Network engineering">Network engineering</option>

<option value="Software engineering">Software engineering</option>

<option value="Information">Information</option>

<option value="E-commerce">E-commerce</option>

<option value="Computer Secience">Computer Secience</option>

<option value="Computer System Engineering.">Computer System Engineering.</option>

<option value="Computer Security">Computer Security</option>

</select>        Specialization

</td>

</tr>

<tr>

<td>

<p align="left"><select size="1" name="TargetSalary" <?=$row['TargetSalary'];?>>

<option>Select------------------------------------------------------

</option>

<option value="Dhs:1000-3000">Dhs:1000-3000</option>

<option value="Dhs:4000-6000">Dhs:4000-6000</option>

<option value="Dhs:7000-9000">Dhs:7000-9000</option>

</select>Target salary   </td>

</tr>

<tr>

<td>

<p align="left">

<span style="font-size: 12.0pt; font-family: Times New Roman">

<select size="1" name="JobType" <?=$row['Fax'];?>>

<option>Select-----------------------------------------------------

</option>

<option value="Permanent">Permanent</option>

<option value="Current">Current</option>

<option value="Part time">Part time</option>

<option value="Internship">Internship</option>

</select>Job Type  </span></td>

</tr>

<tr>

<td>

<p align="left"><span dir="LTR">Yes, any where</span><span style="font-size: 12.0pt; font-family: Times New Roman"><input type="radio" value="YES" name="WillingToRelocate">No

<input type="radio" value="No" name="WillingToRelocate" checked> Willing to Relocate 

</span></td>

</tr>

</table>

<p> </p>

<p> </p>

<p align="center"><input type="reset" value="Reset" name="B2"><input type="submit" value="Submit" name="B1"></p>

</form>

<p align="left"> </p>

<?php

 

    mysql_connect($host,$user,$password) or die("Failed to connect");

    mysql_select_db($db) or die("Falied to select database");

 

    $sql = "SELECT * FROM $table ORDER BY id ASC;";

    $result = mysql_query($sql);

 

    if ($result){

 

        while ($myrow = mysql_fetch_array($result)){

              //echo "<tr><td>$myrow[id]<td>$myrow[Address]<td> $myrow[City]<td>$myrow[Fax]<td>$myrow[specialization]<td>$myrow[TargetSalary]<td>$myrow[JobType]<td>$myrow[WillingToRelocate]";

                echo "<tr><td>$myrow[id]></td></tr>";

                      "<tr><td>$myrow[Address]</td></tr>";

                      "<tr><td>$myrow[City]</td></tr>";

                      "<tr><td>$myrow[Fax]</td></tr>";

                      "<tr><td>$myrow[specialization]</td></tr>";

                      "<tr><td>$myrow[TargetSalary]</td></tr>";

                      "<tr><td>$myrow[JobType]</td></tr>";

                      "<tr><td>$myrow[WillingToRelocate]</td></tr>";

 

 

}}

 

    else

    {

        echo "mysql Error: " . mysql_error();

    }

 

?>

 

 

</body>

 

</html>

Link to comment
Share on other sites

move

<?php

     mysql_connect($host,$user,$password) or die("Failed to connect");
     mysql_select_db($db) or die("Falied to select database");

     $sql = "SELECT * FROM $table ORDER BY id ASC;";
     $result = mysql_query($sql);

     if ($result){

         while ($myrow = mysql_fetch_array($result)){
               //echo "<tr><td>$myrow[id]<td>$myrow[Address]<td> $myrow[City]<td>$myrow[Fax]<td>$myrow[specialization]<td>$myrow[TargetSalary]<td>$myrow[JobType]<td>$myrow[WillingToRelocate]";
                 echo "<tr><td>$myrow[id]></td></tr>";
                      "<tr><td>$myrow[Address]</td></tr>";
                      "<tr><td>$myrow[City]</td></tr>";
                      "<tr><td>$myrow[Fax]</td></tr>";
                      "<tr><td>$myrow[specialization]</td></tr>";
                      "<tr><td>$myrow[TargetSalary]</td></tr>";
                      "<tr><td>$myrow[JobType]</td></tr>";
                      "<tr><td>$myrow[WillingToRelocate]</td></tr>";


}}

     else
     {
         echo "mysql Error: " . mysql_error();
     }

?>

to the top..

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.