Passing dynamic variables

by orisin
2 replies
HI

I need to pass name email and cell phone number from my landing page to the next page. I'm using JS nad my question is if these are the variables I was given in order to pass the data:
fname=
email=
phone=

What comes after the = sign? in order to dynamically pass the unique data?

tnx in advance
#dynamic #passing #variables
  • Profile picture of the author Brandon Tanner
    IMO the best way to do this is via PHP, because there will always be a small percentage of folks who don't have Javascript enabled in their browsers, so if you went the JS route it wouldn't work at all for them. If you're still set on using JS for this though, this page has a good explanation of the process.

    To do this in PHP, however, you would set up the form code on your landing page like so...

    <form method="post" action="nextpage.php">

    <label>First Name</label>
    <input type="text" name="fname">
    <br />
    <label>Email</label>
    <input type="text" name="email">
    <br />
    <label>Phone</label>
    <input type="text" name="phone">
    <br />
    <input type="submit" name="submit" value="submit">

    </form>


    Then on nextpage.php...

    <?php

    $fname = $_POST['fname'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];

    ?>


    And if you need to display any of that data anywhere on that page... for example, their first name...

    <p>Your first name is <?php echo $fname; ?></p>
    Signature

    {{ DiscussionBoard.errors[5501704].message }}

Trending Topics