Jump to content

Recommended Posts

Hi everyone

Need some help here.

I am trying to pull the member numbers from a database and create a link for that to another page.

I do not what to do it in the methos below because that would require me using the get method from the other page. I do not want the number to be displayed.

My thinking was to run an array through the database and pulling all the member numbers and if possible assign those member numbers to a session.

Is this possible, and if so what id wrong with my code below

 

Thanks

 

Lional

 

$member_no_out = $row["member_no"];

 

$fullname = $surnamedb_out . ", " . $firstname_out . " " . $middlename_out;

$memno[$key] = $member_no_out;

print <<<EXIST

 

<table width="690" border="0">

 

<tr>

<td align="center" valign="top">

<font face="arial" size="2"><b>

EXIST;

foreach ($memno as $member) (

print <<<EXIST2

<a href="names.php?mem_no=$member</a>Name</b></font>

</td>

</tr>

</table>

EXIST2;

}}

Link to comment
https://forums.phpfreaks.com/topic/55424-help-with-arrays/
Share on other sites

It depends what you mean by "data being shown". If you mean not having the data show int he URL, you could use a miniform form for each name. However, the user could see the data on the first page if they looked at the source code.

 

<form action="names.php" method="POST" name="member_<?php echo $member; ?>">
 <input type="hidden" value="<?php echo $member; ?>">
</form>
<a href="#" onclick="document.forms['member_<?php echo $member; ?>'].submit();">Name</font>

 

But, I'm curious what your aversion is to having the user see the member id number. The number should have no relevance to the end user. If it does, then you should create a new field to use as the id that does not have any relevance for the user.

 

Another option - which I would not advise - would be to run your page in a frame.

Link to comment
https://forums.phpfreaks.com/topic/55424-help-with-arrays/#findComment-273929
Share on other sites

Hi mjdamato

The answer to your question is that I am writing an app for an organisation to do end year reports. Some of the members get kicks out of trying to break a program. If they new that was the member number being sent to the next page, could they not manually change that which would send the wrong details through.

Link to comment
https://forums.phpfreaks.com/topic/55424-help-with-arrays/#findComment-273947
Share on other sites

Then you are taking the wrong approach. You should validate the data sent.

 

So when the page receives a member id on the query string you woudl first check to see if the id is valid or not. Something like this:

 

<?php

$member_no = $_GET['mem_no'];

$query = "SELECT * FROM members where mem_no = '".mysql_escape_string($_GET['mem_no'])."'";
$result = mysql_query($query) or die (mysql_error());

if (!mysql_num_rows($result)) {

  echo "Invalid member number ($member_no)";

} else {

  //Display the member details

}

?>

Link to comment
https://forums.phpfreaks.com/topic/55424-help-with-arrays/#findComment-274054
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.