473,516 Members | 3,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass form input through multiple pages.

142 New Member
Hi,

I have a from where you type in your username, it then goes to my logbook.php.

In the logbook I do like Select FROM database $username.

The logbook page display only x amount of result per page and then make a link for page 2, page 3 etc. for the rest of the results.

The problem is if I click on say page to 2 my page does not display the result cause $username is no specified.

How can I keep the $username var?

Here the part of my script where I need the $username to alway be when specified.
----------------------------------
[PHP]

};

for ($k=0; $k<$pages; $k++) {
if ($k != $_REQUEST[page]) {
$lynx .= "<a href=$PHP_SELF"."?page=$k>".($k+1)."</a>";

} else {
$lynx .= " <b>--".($k+1)."--</b>";
}
}
?>
<br />
<?= $html ?>
<span class="style1">Please choose the next page you want to view</span>:
<?= $lynx ?>
[/PHP]

--------------------------------------------------

I want to example

[PHP]
};

for ($k=0; $k<$pages; $k++) {
if ($k != $_REQUEST[page]) {
$lynx .= "*******POST_$username with link this link*******<a href=$PHP_SELF"."?page=$k>".($k+1)."</a>";

} else {
$lynx .= " <b>--".($k+1)."--</b>";
}
}
?>
<br />
<?= $html ?>
<span class="style1">Please choose the next page you want to view</span>:
<?= $lynx ?>
[/PHP]

Thanks
Aug 28 '07 #1
3 1401
Dreea
37 New Member
Expand|Select|Wrap|Line Numbers
  1. <a href=$PHP_SELF"."?page=$k&username=$username>".($k+1)."</a>";
and then your username would be in $_GET['username']

It would be more appropriate to select the rowid(assuming your table has an unique id) corresponding to the username
Expand|Select|Wrap|Line Numbers
  1. SELECT id FROM your_table WHERE username=$username
and then to pass only the id to the other pages
Aug 28 '07 #2
webandwe
142 New Member
I still get the problem, please check my script

[PHP]
<?php
$username=$_GET['username'];
$username=$_POST['username'];
$submit = $_POST['submit'];
$self = $_SERVER['PHP_SELF'];
$table = $_POST['table'];
$self = $_SERVER['PHP_SELF'];

if (isset($_POST['table'])) {
$table = $_POST['table'];
} else {
$table = 'a';
}

if ($self)

{
$conn=mysql_connect( "asdfasdf", "asdf", "asdfsadf")
or die( "Err:Conn");

$rs= mysql_select_db ( "divereg2", $conn )
or die ( "Err:Db");

# Create the query

$sql="select dive from $username";


#execute

$rs = mysql_query( $sql, $conn );
if (!$rs) {
die("query error! query text: $sql<br />Error Message: ".mysql_error());
}

#write data

}

$perpage = 2;
$lynx = $html = "";
$startat = $_REQUEST[page] * $perpage;

$q = mysql_query("select count(dive) from $username");
$row = mysql_fetch_array($q);
$pages = ($row[0] + $perpage - 1) / $perpage;

$q = mysql_query("select * from $username order by dive desc limit $startat,$perpage");

while ($row = mysql_fetch_assoc($q)) {
$text = strip_tags($row[entry_text]);
$text = substr($text,0,300);
#table
echo("<table width=\"450\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\" bordercolor=\"005BB7\">
<tr>
<td width=\"227\"><strong>Businesname</strong></td>
<td width=\"16\">&nbsp;</td>
<td width=\"227\"><strong>E-mail</strong></td>
</tr>
<tr>
<td><dt>$row[dive] <a href=/mouth/$row[dive]_.html target=pix>$row[entry_title]</a></dt></td>
<td></td>
<td><dt>$row[email] <a href=/mouth/$row[email]_.html target=pix>$row[entry_title]</a></dt></td>
</tr>
<tr>
<td><strong>Postal</strong></td>
<td></td>
<td><strong>Website</strong></td>
</tr>
<tr>
<td><dt>$row[postal]<a href=/mouth/$row[postal]_.html target=pix>$row[entry_title]</a></dt></td>
<td></td>
<td><dt>$row[website] <a href=/mouth/$row[website]_.html target=pix>$row[entry_title]</a></dt></td>
</tr>
<tr>
<td><strong>Company VAT Reg. No</td>
<td></td>
<td><strong>Chairman/ President/ MD</strong></td>
</tr>
<tr>
<td><dt>$row[company_vat] <a href=/mouth/$row[company_vat]_.html target=pix>$row[entry_title]</a></dt></td>
<td></td>
<td><dt>$row[c_p_md] <a href=/mouth/$row[c_p_md]_.html target=pix>$row[entry_title]</a></dt></td>
</tr>
<tr>
<td><strong>Street Address</strong></td>
<td></td>
<td><strong>Contact Name</strong></td>
</tr>
<tr>
<td><dt>$row[street_address] <a href=/mouth/$row[street_address]_.html target=pix>$row[entry_title]</a></dt></td>
<td></td>
<td><dt>$row[contact_name] <a href=/mouth/$row[contact_name]_.html target=pix>$row[entry_title]</a></dt></td>
</tr>
<tr>
<td><strong>Tel</strong></td>
<td></td>
<td><strong>Job Title</strong></td>
</tr>
<tr>
<td><dt>$row[tel] <a href=/mouth/$row[tel]_.html target=pix>$row[entry_title]</a></dt></td>
<td></td>
<td><dt>$row[job_title] <a href=/mouth/$row[job_title]_.html target=pix>$row[entry_title]</a></dt></td>
</tr>
<tr>
<td><strong>Fax:</strong></td>
<td></td>
<td><strong>Cellphone No:</strong></td>
</tr>
<tr>
<td><dt>$row[fax] <a href=/mouth/$row[fax]_.html target=pix>$row[entry_title]</a></dt></td>
<td></td>
<td><dt>$row[cell] <a href=/mouth/$row[cell]_.html target=pix>$row[entry_title]</a></dt></td>
</tr>
<tr>
<td></td>
<td></td>
<td><strong>Main business Activity</strong><br/>
<dt>$row[business_activity] <a href=/mouth/$row[business_activity]_.html target=pix>$row[entry_title]</a></dt>
</td>
</tr>
</table><br/><hr>");


};

for ($k=0; $k<$pages; $k++) {
if ($k != $_REQUEST[page]) {
$lynx .= "<a href=$PHP_SELF"."?page=$k&username=$username>".($k +1)."</a>";

} else {
$lynx .= " <b>--".($k+1)."--</b>";
}
}
?>
<br />
<?= $html ?>
<span class="style1">Please choose the next page you want to view</span>:
<?= $lynx ?>
[/PHP]
Aug 28 '07 #3
ak1dnar
1,584 Recognized Expert Top Contributor
Alternatively you can store the username in a session variable. find out how
Aug 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2008
by: james00_c | last post by:
Greetings- I need to pass multiple email addresses to a "sendto" hidden field in a form. I need to do that because "CC" and "BCC" are not an option. One address webmaster@xyz.com would be hardcoded and another say formuser@xyz would be a user input. A sample of my form looks like: <table> <tr> <td width="100%"> <form name="fname"...
4
13306
by: Alex Maghen | last post by:
I have a master page which contains a general page framework and also contains a <form runat=server> around most of the content of the page. Inside that <form> tag is a ContentPlaceholder. I then create an ASPX which is tied to that MasterPage and in it a put a bunch of form fields and an <asp:Button />. When I try to run the page, I get......
1
9329
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i need to open the new page in the main page window with passing the two textbox parameters into the new page. Program opens the new page but dont know...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7405
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3265
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.