Re[2]: [PHP] Newbie HTML-form & PHP question
| From: | David Tod Sigafoos | Date: | Mon, 25 Sep 2000 17:44:32 +0000 |
| Subject: | Re[2]: [PHP] Newbie HTML-form & PHP question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-17368@lists.php.net to get a copy of this message | ||
Hello Bart,
Monday, September 25, 2000, 10:19:21 AM, you wrote:
BAV> How do I check if the e-mail-adress specified by the visitor against the
BAV> adresses in my db?
Once you have verified that they have entered a email addresse then do
a simple test select like .. (be sure to check syntax ..)
SqlQry = "SELECT * FROM updateservice with email = $email"
if !(mysql_query($sql))
{
# here do what you want if there were no records .. be aware that
this might return multiple records with different name.
}
BAV> I use the folowing script to check if a value is filled out and to submit
BAV> data to MySQL (sorry for the dutch frases?!).
BAV> I also would like to know how
BAV> to let the visitor check the filled out information and after approval
BAV> submit it to MySQL.
Not sure what you mean here .. it looks like this is what you are
doing. I might have missed something
Let me know ..
DSig
David Tod Sigafoos
AV> <!--BEGIN PHP-CODE-->
BAV> <?php
BAV> require ('file.inc');
//if **name '0' ->>go back to form and exit script.
BAV> if ($lastname == "" || $email =="") {
BAV> echo("U heeft geen achternaam of e-mailadres ingevuld. Keer terug naar het
BAV> formulier en vul deze gegevens in.");
BAV> exit();
BAV> // else insert and display submitted info.
BAV> } else {
BAV> $sql="INSERT INTO updateservice SET " .
BAV> "titel='$titel', " .
BAV> "firstname='$firstname', " .
BAV> "lastname='$lastname', " .
BAV> "email='$email', " .
BAV> "date=CURDATE()";
BAV> if (mysql_query($sql)) {
BAV> // Als titel=Y Heer weergeven anders als N: mevouw weergeven met naam.
BAV> if ($titel =='Y')
BAV> $htmltitel = "Heer" ;
BAV> } else
BAV> $htmltitel = "Mevrouw" ;
BAV> }
BAV> echo("<div align='center'><center><p>
BAV> <b>Geachte " . $htmltitel . " " . $lastname .
BAV> ",<br>
BAV> De volgende gegevens zijn
BAV> verwerkt:</b><br></p><p></p></center></div>
BAV> <div align='center'><table align='center'
BAV> width='80%'
cellspacing='1'>>
BAV> <tr><td width='20%' align='right'><font
BAV> size='2' face='Verdana'>
BAV> <b>Naam:</b></font></td><td
BAV> align='left'><font size='2'
face='Verdana'>>" .
BAV> $htmltitel . " " . $firstname . " " . $lastname .
BAV> "</font></td></tr>
BAV> <tr><td align='right' nowrap><font size='2'
face='Verdana'>><b>E-mail:</b></font></td>
BAV> <td align='left'><font size='2'
face='Verdana'>>".$email."</font></td>
BAV> </tr></table></div>
BAV> <p></p><p>Hartelijk dank voor uw inschrijving.</p>");
BAV> } else {
BAV> echo("<P><font size='2' face='Verdana'>Er is een
BAV> fout opgetreden bij het
BAV> verwerken van de door u opgegeven gegevens:<br>
BAV> De volgende fout heeft zich voorgedaan:</font></p>
BAV> <p><b>" . mysql_error() . "</b><br>" .
BAV> mysql_errno() . "</p>");
BAV> }
BAV> }
?>>
BAV> <!--END PHP-CODE-->
BAV> -----Oorspronkelijk bericht-----
BAV> Van: David Tod Sigafoos [mailto:dsig@teleport.com]
BAV> Verzonden: maandag 25 september 2000 17:09
BAV> Aan: php-general@lists.php.net
BAV> CC: Bart A. Verbeek
BAV> Onderwerp: Re: [PHP] Newbie HTML-form & PHP question
BAV> Hello Bart,
BAV> here is a little snippet of code .. I just got this from phpPolls.
>>From phpwizard.com.
BAV> You should look at phpwizard and phpbuilder and SourceForge for
BAV> samples. Like I said .. after reading your note I simply went there
BAV> and got this down.
BAV> if($poll_optionText != "")
BAV> {
BAV> echo "<input type=\"radio\" name=\"poll_voteNr\"
BAV> value=\"".$i."\" ";
BAV> // set the first button as default
BAV> if($poll_default == 0)
BAV> {
BAV> $poll_default = 1;
BAV> echo "checked ";
BAV> }
BAV> echo "> $poll_optionText <br>";
BAV> }
BAV> }
BAV> // show submit button
BAV> echo "<input type=\"submit\" value=\"Vote\">";
BAV> Hope this helps
BAV> DSig
BAV> David Tod Sigafoos
BAV> Wednesday, September 20, 2000, 6:08:50 AM, you wrote:
BAV>> Hello,
BAV>> I'm creating a form that will allow users to subscribe thereselves to a
BAV>> database-mailinglist.
BAV>> now I've got one question:
BAV>> How does PHP handle radiobuttons. I want to let the visitor decide If
BAV> there
BAV>> [male] or [female] and than store the decided entry in the database. Is
BAV> it
BAV>> possible to writre the script so that [male]=1 and [female]=0 (or 'Y' &
BAV> 'N')
BAV>> and than store the entry?
BAV>> I don't know how to. maybe all you can help.
BAV>> regards
BAV>> bart
BAV> --
BAV> Best regards,
BAV> David mailto:dsig@teleport.com
--
Best regards,
David mailto:dsig@teleport.com