Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1028219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:21:14+00:00 2026-05-16T12:21:14+00:00

I have a page where I am using a PHP while loop to echo

  • 0

I have a page where I am using a PHP while loop to echo the names and addresses of our dealers. For the email link, I want the user to be able to click the link, which would then take him to a form that emails that person.

I know that you can’t mix Javascript and PHP, so how do I tell which link the user has clicked on so that I can pass that variable to the form on the next page? Here is my code:

<?php while($row = mysql_fetch_array($result)) { 
          if ($row['active'] == 1) {

?>

      <div id="dealer">

          <div id="dealername">
              <h3 style="float:left;"><?php echo $row['company']; ?></h3><br/>
              <p><?php echo $row['address1']; ?><br/>
                 <?php if($row['address2'] || $row['address3']) { 
                        echo $row['address2'] . ' ' . $row['address3'] . '<br/>'; } ?>
                 <?php echo $row['city']; 
                 if ($row['state']) {
                          echo ', ' . $row['state'];
                  }
                  echo '&nbsp;&nbsp;' . $row['zip']; ?>
                  <br />
                  <?php echo $row['country']; ?>

                  <br />
                  <br />
                  Phone: <strong><?php echo $row['phone1']; ?></strong><?php if ($row['phone2']) {
                      echo ' or ' . $row['phone2']; } ?><br/>
                  <?php if($row['fax']) { echo 'Fax: ' . $row['fax'];  } ?><br />
              </p>
          </div>

          <?php if ($row['email']) {
              echo '<div class="dealerEmail">'. // need help here . '</div>';

            } ?>

        <br class="clearall" />
        </div>




<?php }} ?>

The page that this code appears on is pulling data from a database using a GET statement based on a URL similar to “index.php?state=az”.

I’ve tried making the email link use a “?email=…” format but when I go to the dealer-email.php page there are no parameters in the URL, which I don’t get. That’s why I’m trying to find some other way to pass some kind of variable to the next page, based on which link the user clicks on.

Hope this is clear. Thanks in advance for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:21:15+00:00Added an answer on May 16, 2026 at 12:21 pm

    this should work fine:

    <a href="somepage.php?email=<?php echo $row['email']; ?>">contact dealer</a>
    

    and then you retrieve the data in the somepage.php page:

    if(isset($_GET['email']))
        $email = $_GET['email'];
    else
        //redirect somewherelse
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 535k
  • Answers 535k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here's a solution which takes advantage of recursion. Not sure… May 17, 2026 at 1:10 am
  • Editorial Team
    Editorial Team added an answer Lazy evaluation? Sounds like a good candidate for lazy evaluation.… May 17, 2026 at 1:10 am
  • Editorial Team
    Editorial Team added an answer Use CTRL-R with the expression register =. The following command… May 17, 2026 at 1:10 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a large PHP loop that I'm re-using in multiple spots on multiple
So I have a page called latest news and using a custom template t_latest_news.php
I am using PHP 5 to create a query page for a MySQL database
I have been trying to display image from database using php but i am
I would like to submit information to a mySql database using php and ajax.
Current scenario: I'm using the gmail oauth api to receive emails on a page.
I've been working on this for a while and have tried a lot of
I want to use php array for HTML select list. In this case it
I have PHP file where I have defined the server access variables as well
I've been dabbling in writing a PHP Class for a few weeks now and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.