Jump to content

[SOLVED] Help With PHP Please


CoolAffiilate

Recommended Posts

I am very new to PHP, and I dont know if this is even possible. I will try to explain the best I can.

 

A person votes for something, and once they click submit a prompt pops up and asks for the e-mail address. They input the e-mail address into the prompt, then the e-mail address is passed to the next page. Would this be possible, and how would I go about doing it?

Link to comment
https://forums.phpfreaks.com/topic/76551-solved-help-with-php-please/
Share on other sites

you could have the email form on the page, and then on the next page have <?php $email = $_POST['whatever you called the email field']; ?> and then $email would be the email address. As for the popup, I'm not sure. Javascript would do that I guess.

here's one way using javascript and a hidden form field

<?php
if (isset($_GET['sub']))
{
    echo 'Email ', $_GET['email'], '<br/>';
    echo 'Rating ', $_GET['rating'], '<br/>'; 
}
?>
<html>
<head>
<meta name="generator" content="PhpED Version 4.5 (Build 4513)">
<title>Sample</title>
<meta name="author" content="Barand">
<script>
         function doSubmit()
         {
            var email = prompt("Please enter you email address","");
            document.getElementById("email").value = email;
            return email != "";
         }
</script>
</head>
<body>
<form onsubmit="return doSubmit()">
<input type="hidden" name="email" id="email" value="">
Rating <input type="radio" name="rating" value="1">1 
<input type="radio" name="rating" value="2">2 
<input type="radio" name="rating" value="3" checked>3 
<input type="radio" name="rating" value="4">4 
<input type="radio" name="rating" value="5">5
<br/>
<input type="submit" name="sub" value="Vote">
</form> 
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.