merge two related page together PHP

Wednesday, November 4, 2015

i have two page. first one give information about user and second one sends them to database table.



i wonder if i can put all codes in just one page because of i have too many page and some times and i should search for find my pages. here is two pages that are related together:



submit_job.php:



   <fieldset class="fdex" >
<legend><span class="style4">تعیین شغل</span></legend>


<?php

$db_host = 'localhost';
$db_name= 'site';
$db_table= 'job_list';
$db_user = 'root';
$db_pass = '';


$con = mysql_connect($db_host,$db_user,$db_pass) or die("خطا در اتصال به پايگاه داده");

mysql_query("SET NAMES 'utf8'", $con);
mysql_query("SET CHARACTER SET 'utf8'", $con);
mysql_query("SET character_set_connection = 'utf8'", $con);

$selected=mysql_select_db($db_name, $con) or die("خطا در انتخاب پايگاه داده");
mysql_query("SET CHARACTER SET utf8");
$dbresult=mysql_query("SELECT * FROM $db_table",$con);
echo "توانمندی مورد نظر خود را انتخاب نمایید: ";?><br/>
<form name="form2" method="post" action="send.php" accept-charset='UTF-8'>

<?php
echo '<select name="job">';
?>
$user_id=<?= $fgmembersite->UserFullname(); ?>

<?php

while($amch=mysql_fetch_assoc($dbresult))
{
echo '<option value="'.$amch['job_id'].'">'.$amch['job_name'].'</option>';
}
echo '</select>';
?><br/>

<textarea name="textaria" cols="" rows=""></textarea>
<input name="submit" type="submit" value="submit" />


and also second page contents:



 <?php
$user_id =$fgmembersite->UserID(); ?>
<?php
echo "$user_id ";
?>



<?php
$db_host = 'localhost';
$db_name= 'site';
$db_table= 'relation';
$db_user = 'root';
$db_pass = '';


$con = mysql_connect($db_host,$db_user,$db_pass) or die("خطا در اتصال به پايگاه داده");

mysql_query("SET NAMES 'utf8'", $con);
mysql_query("SET CHARACTER SET 'utf8'", $con);
mysql_query("SET character_set_connection = 'utf8'", $con);

$selected=mysql_select_db($db_name, $con) or die("خطا در انتخاب پايگاه داده");
$ins = "INSERT INTO $db_table (job_id,user_id,comments) VALUES ('" . mysql_escape_string($_POST['job']) . "','$user_id ', '" . mysql_escape_string($_POST['textaria']) . "')";
$saved=mysql_query($ins );
mysql_close($con);
echo "('" . mysql_escape_string($_POST['job']) . "')";
?>


i just want a way to merge these pages in only one page. it is better than have too many pages.

0 comments:

Post a Comment