0

I am attempting my first project and need to accomplish something relatively simple. I have a form with ‘name’ and ‘email’ fields. Once submitted, I need them to write on a separate success page. Here is what I’ve tried:

The form:

<form action="success.html" method="GET">
  <p>
    <label>First Name</label>
    <input type="text" id="firstname" name="firstname">
  </p>
  <p>
    <label>Email</label>
    <input type="email" id="email" name="email">
  </p>
  <p>
    <input type="submit" value="Submit">
  </p>
</form>

The success page

<html>

<head>
  <title>Success</title>
</head>

<body>
  <p>Thank you
    <script>
      document.write(firstname);
    </script>,<br /> We will be in touch soon. Please check your email:
    <script>
      document.write("email") for further instructions. < /p> <
        p > If you would like immediate assistance, please call: 800 - 245 - 0370. < /p>

        <
        /body> <
        script type = "text/javascript" >
        window.rrSpace = (
          rrSettingsConversion = {
            debug: "false",
            parameters: {
              firstname: document.getElementById('firstname');,
              email: document.getElementById('email');,
            }
          }
        );
      (function(f, r, n, d, b, y) {
        b = f.createElement(r), y = f.getElementsByTagName(r)[0];
        b.async = 1;
        b.src = n;
        b.id = 'RR_DIVID';
        y.parentNode.insertBefore(b, y);
      })(document, 'script', '//ussolar.referralrock.com/webpixel/beta/universalv03.js');
    </script>

</html>
  • I think you're looking for info on how to read query parameters. https://dev.to/ganeshmani/how-to-get-query-string-parameters-in-javascript-2019-4dm2 – Matt Apr 27 '20 at 18:52
  • First of all, really think about whether you need to use `document.write`. You almost always don't. Also, you need to read the query parameters from the URL, which is answered in several questions on this site. – Heretic Monkey Apr 27 '20 at 18:54

0 Answers0