anchors

Code:
 <tr>
      <td colspan="8" align="left" class="body_text_headings" id="infostrings4"><a name="anchor<?php echo $s; ?>" id="anchor<?php echo $s;

?>"></a>&nbsp;(Record&nbsp;No.:&nbsp<?php echo $s; ?>)&nbsp; <input type="submit" name="" id="" value="Update Signature to Database" /></td>
  </tr>

This piece of code and the value of $s is within a form tag and is repeated down the page a number of times as a loop.
I did not post all the code as it would be confusing and would not really be relevant to my question
There is an anchor defined in the code
All I need is to be able to submit the main form using the submit button which is repeated down the page BUT pass the anchor  value for THIS PARTICULAR RECORD in the string- ie:
pagereference?anchor#<?php echo $s; ?>
doctorbillTechAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
What do you want to do with the anchor?  I think you might want to send it in the form of a URL argument as well as a hashtag anchor.  I doubt if the action script can see the anchor, since it's only there for the browser.
0
Ray PaseurCommented:
See if this makes sense for your needs...

<?php // RAY_temp_doctorbill.php
error_reporting(E_ALL);

// SHOW THE REQUEST VARIABLES
var_dump($_GET);

// GENERATE SOME ANCHOR AND SUBMIT
$links = range(1,4);
$text  = NULL;
foreach ($links as $num)
{
    $text
    .= '<a name="'
    . $num
    . '">'
    . '<input type="submit" name="signal_'
    . $num
    . '" value="'
    . "$num"
    . '">'
    . '</a>'
    . PHP_EOL;
}
// SHOW THE HTML
$html = <<<EOD
<form method="get">
$text
</form>
EOD;

echo $html;

Open in new window

HTH, ~Ray
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chris StanyonWebDevCommented:
The code you've posted won't actually post anything to your script as there are no form elements. I would name each submit button as part of an array, containing the record number as the key and then read that back in your script:

<input name="recordNumber[<?php echo $s ?>]" type="submit" value="Update Signature to Database">

Open in new window

Then in your action script you'll have an array ($_GET['recordNumber']) containing the record number:

foreach ($_GET['recordNumber'] as $recNo => $value):
	var_dump($recNo);
endforeach;

Open in new window

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

COBOLdinosaurCommented:
You may think the rest of the code is unnecessary, but what we relly need is a link instead of a couple of lines of code with no context.

Cd&
0
doctorbillTechAuthor Commented:
ChrisStanyon:
Once the records have been dumped how do I send the specific anchor id back to the page
0
Chris StanyonWebDevCommented:
Not entirely sure what you mean, but if you want to jump to a particular part of your page based on a named anchor, then build the url in PHP and set the header location:

foreach ($_GET['recordNumber'] as $recNo => $value):
     $namedAnchor = 'anchor' . $recNo;
endforeach;

header("Location: index.php#$namedAnchor");

Open in new window

0
Ray PaseurCommented:
You can't send the anchor id.  The link does not give the anchor id to the action script.  You have to make two data elements.   One is the anchor hashtag, and one is data that goes to the action script.

Run the script I posted above - install it on your own server and then put up a page that points to it with anchor tags in the link to it.  You may need to add a lot of "filler" to make the submit buttons be far enough apart to see the effect of the direct link to the anchors.
0
doctorbillTechAuthor Commented:
thanks all
0
Ray PaseurCommented:
Thanks for the points and thanks for using EE, ~Ray
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.