Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Registration form (php/ mysql)

registration mysql

  • Please log in to reply
4 replies to this topic

#1 morrow30

morrow30

    CC Lurker

  • No Access
  • Pip
  • 3 posts
  • Programming Language:PHP
  • Learning:PHP

Posted 17 October 2012 - 12:59 AM

I am doing a college assignment which is due end of this mth (Oct 2012)
I am struggling to find out why I cannot insert certain text fields into my MySQL table, everything looks correct
to me, but obviously isn't.
I really need some one to physically look at my project and tell me what exactly is wrong. I can email the project pls guys
it is just 1mb big.
  • 0

#2 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 17 October 2012 - 01:06 AM

How do your query look like, and how do the table look like?
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#3 morrow30

morrow30

    CC Lurker

  • No Access
  • Pip
  • 3 posts
  • Programming Language:PHP
  • Learning:PHP

Posted 17 October 2012 - 01:12 AM

I dont know where to start, basically the registration process page is incorrect, one needs to run it on a local server
man its hard to explain
  • 0

#4 morrow30

morrow30

    CC Lurker

  • No Access
  • Pip
  • 3 posts
  • Programming Language:PHP
  • Learning:PHP

Posted 17 October 2012 - 01:50 AM

<?php
include_once('../config.php');
if(isset($_POST['Submit']))
{
$cid=$_POST['cid'];
$sname=$_POST['sname'];
$init=$_POST['init'];
$fname=$_POST['fname'];
$title=$_POST['title'];
$sname=$_POST['msname'];
$dob=$_POST['dob'];
$gen=$_POST['gen'];
$lang=$_POST['lang'];
$idno=$_POST['idno'];
$sname=$_POST['telh'];
$sname=$_POST['telw'];
$cel=$_POST['cel'];
$sname=$_POST['fax'];
$email=$_POST['email'];
$address=$_POST['address'];
$contact_flag=$_POST['contact_flag'];

if(empty($cid) || empty($sname) || empty($fname) || empty($dob) || empty($idno) || empty($cel) || empty($email) || empty($address))
{
if(empty($cid))
{
echo '<font color="red">You must choose atleast one Course for Registration <img src="../images/sadsmiley.gif" width="15" height="22"></font><br/>';
}
if(empty($sname))
{
echo '<font color="red">You must specify your Last Name for us to Identify you <img src="../images/sadsmiley.gif" width="15" height="22"></font><br/>';
}
if(empty($fname))
{
echo '<font color="red">You must specify your Name for us to Identify you <img src="../images/sadsmiley.gif" width="15" height="22"></font><br/>';
}
if(empty($dob))
{
echo '<font color="red">You must specify your Date of Birth <img src="../images/sadsmiley.gif" width="15" height="22"></font><br/>';
}
if(empty($idno))
{
echo '<font color="red">You must specify your unique South African or Foreign Identity Number <img src="../images/sadsmiley.gif" width="15" height="22"></font><br/>';
}
if(empty($cel))
{
echo '<font color="red">You must specify your Cell Phone Number for us to contact you via SMS <img src="../images/sadsmiley.gif" width="15" height="22"> </font><br/>';
}
if(empty($email))
{
echo '<font color="red">You must specify your E-mail address for us to contact you via E-mail <img src="../images/sadsmiley.gif" width="15" height="22"></font><br/>';
}
if(empty($address))
{
echo '<font color="red">You must specify your Residential or Postal Address for Letters and Post <img src="../images/sadsmiley.gif" width="15" height="22"></font><br/>';
}
echo '<br/><a href="javascript:self.history.back();"><font color="red"><strong>GO BACK AND COMPLETE FORM</strong></font></a>';
}
else
{
$result=mysql_query("INSERT INTO course_student (cid) VALUES ('$cid')");
$result=mysql_query("INSERT INTO student (sname,init,fname,title,msname,dob,gen,lang,idno,telh,telw,cel,fax,email,address,contact_flag) VALUES('$sname','$init','$fname','$title','$msname','$dob','$gen','$lang','$idno','$telh','$telw','$cel','$fax','$email','$address','$contact_flag')");
echo '<font color="green">Thank You for Choosing us! <img src="../images/books.jpg" width="160" height="144">';
}
}
?>

This is the php process script..
The form itself has appropriate text fields, drop downs etc. but not all insert into my 2 tables, is this page correct? I'm a total beginner
  • 0

#5 Colanth

Colanth

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 165 posts
  • Location:Fayetteville, NC, USA
  • Programming Language:PHP, (Visual) Basic, JavaScript, Visual Basic .NET, Pascal, Logo, Assembly, VBScript, Others

Posted 03 November 2012 - 12:48 PM

$cid=mysql_real_escape_string($_POST['cid']);

Do that to all your other user-supplied values.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download