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

  • Home
  • SEARCH
  • 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

Related Questions

I am using php and simple_html_dom library. I have a page on my site
i have this simple code to load data from other php page using get
I have a PHP page that loads external content using other PHP files. I'm
I have a page called Error.php. Variables are usually passed to it using the
I have one page website only using HTML, CSS and JavaScript. I want to
Using PHP , I would like to make a while loop that reads a
I have a large PHP loop that I'm re-using in multiple spots on multiple
I have a page using something along the lines of <meta http-equiv=refresh content=0;url=http://example.com/ />
I have page (Default1.aspx) in which I am redirecting to another page (Default2.aspx) using
I have saved an html page using the following line of code : NSURL

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.