Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Mysql Issue?

Asked Modified Viewed 1,838 times
A
AthlonJedi
A
  • Junior Member, joined since
  • Contributed 30 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
asked
Junior Member

I am experiancing an odd problem with the system and mysql. I dont know if this is a coding issue or a bug in Fusion.

But here is the problem. I have 2 custom pages in which the first is a form that makes your basic signup type page, The second takes the information from the form and displays it on a confirmation page to make sure the info you entered is correct before submitting it to a third page which is NOT made inside Php-Fusion that is suposed to take the info and insert it into a database.

here is the page made in dreamweaver CS



 <?php
//form variables
$fname = $_POST["fname"];
$mname = $_POST["mname"];
$lname = $_POST["lname"];
$comp = $_POST["comp"];
$email = $_POST["email"];
$add1 = $_POST["add1"];
$add2 = $_POST["add2"];
$phone1 = $_POST["phone1"];
$phone2 = $_POST["phone2"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$package = $_POST["package"];
$domain = $_POST["domain"];



//mysql stuff
$server = "*****";
$user = "*****";
$pw = "*****";

//Mysql Connect
$con = mysql_connect($server, $user, $pw);

 if(!$con)
      {
         echo("Can not connect to the server:" . mysql_error() );
       exit();
       }

//Select the DB      
$dbcon = mysql_select_db(*****);

    if(!$dbcon)
      {
         die('Could not connect to the database:' . mysql_error());
       exit();
       }

// Insert form data

     
      $sql = "INSERT INTO ***** (fname,mname,lname,comp,email,add1,add2,phone1,phone2,city,state,zip,package,domain) VALUES ('$fname','$mname','$lname','$comp','$email','$add1','$add2','$phone1','$phone2','$city','$state','$zip','$package','$domain')";
      
        // mysql_query($sql)
       
        if (mysql_query($sql))
            {
             echo "<br><br><br><br><br><br><br><br><br><br>Thank you for choosing www.adabraxix.net for your web hosting needs. We look forward to serving you in the future.
<br>
<br>
<br>
 Please allow up to 48 hrs for your selected package to be activated. An email with the information you entered will be sent to the email address you provided for your records.";
}


else
   {
    echo "ERROR:" . mysql_error();
   }
   
   

mysql_close($con);


?>



Now the odd thing is this, I have tryed using "INSERT INTO ****(..............) VALUES( '$_POST[fname]' , ..........); , and "INSERT INTO **** (...........) VALUES ( 'fname' , ...........); , and even "INSERT INTO ****(.........) VALUES ('$fname', ........); and every variation i can think of and the only thing I can get this code to do is when I use "INSERT INTO **** (...........) VALUES ('fname' , .......); , the variable names being the 'fname' part, end up in the database and NOT the information thats suposed to be stored in them!!!!!

what I do not understand is why the custom pages coded within Php-fusion work as expected BUT when I try to take the information OUTSIDE the system, its as if the variables are not keeping the data stored in them and I have thus far ended up with 42 worthless entrys in my database with either just variable names in them or nothing at all but an ID number for the record.

Any ideas? Is there a special trick to take information from variables made within the system to pages not coded within the system? I have even made another variable array at the top thinking maybe they needed to be reinitialized with the values from the form data but no luck.

:o any help would be apriciated


EDIT: One more thing I noticed, If I try to take the above code and make it a custom page i end up getting all kinds of mysql errors like ***_table does not exist, _bla column does not exist, complaining about tables and columns not being in the database i used to set up the site with.
Edited by AthlonJedi on 25-01-2008 03:42,
0 replies

7 posts

A
AthlonJedi
A
  • Junior Member, joined since
  • Contributed 30 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
answered
Junior Member

no ideas yet? ill check back later but I really need to fix this, its holding up my ability to make money !!! lol so Please mysql gurus HELP!!!!
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

put var_dump($_POST); at the top to see if the values "arrive" on your page.
0 replies
A
AthlonJedi
A
  • Junior Member, joined since
  • Contributed 30 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
answered
Junior Member

this is what I get at the top of the confirm page with the Var_dump:

array(1) { ["submit"]=> string(19) "Lets Finish This!!!" }

which I think is telling me its getting "Lets Finish This!!!" instead of any Variables. But thats my best guess lol
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

yes, this means only your submit button value is submitted. please post the form you used.
0 replies
A
AthlonJedi
A
  • Junior Member, joined since
  • Contributed 30 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
answered
Junior Member

k here is the form I coded:



<form action="viewpage.php?page_id=6" method="post">
* First Name:<input type="text" size="25" name="fname">

* Middle Initial:<input type="text" size="2" name="mname">

* Last Name:<input type="text" size="25" name="lname">
<br>
<br>
* Company:<input typpe="text" size="35" name="comp">

* Valid Email:<input type="text" size="35" name="email">
<br>
<br>
* Address 1:<input type="text" size="25" name="add1">
Contact Phone:<input type"text" size="10" name="phone1">
Alt. Phone:<input type="text" size="10" name="phone2">
<br>
<br>
* Address 2:<input type="text" size="25" name="add2">


* City:<input type="text" size="25" name="city">


* State / Province:<input type="text" size="25" name="state">
<br>
<br>
* Zip / Postal Code:<input type="text" size="5" name="zip">
<br>
<br>
* Please select the package you wish to signup for:
<select name="package">
<option value="Free">Free Hosting( Ad Supported)</option>
<option value="Basic">Basic Hosting( $3.95 Mo )</option>
<option value="Standard">Standard Hosting( $5.95 Mo )</option>
<option value="Standard Plus">Standard Plus Hosting( $7.95 Mo )</option>
<option value="Elite">Elite Hosting( $9.95 Mo )</option>
<option value="Elite Plus">Elite Plus Hosting( $11.95 Mo )</option>
</select><br />
<br>
<br>
<br>
<b>Free or sub-domain accounts please enter your desired sub-domain name below. ( Ex. mydomainname.adabraxix.net )
<br>
<br>
<input type ="text" size="35" name="domain">.adabraxix.net</b>
<br>
<br>



<center>
 Please tell us a little about your site. Be sure to include information you may be unsure about regarding our terms of service.
<br>
<br>
<textarea rows="10" cols="50" name="quote" wrap="physical"></textarea></center>


<br>
<br>
<br>
<center>
<input type="submit" value="On to next step" >
</form>

<?php

//variables for form data

$fname = $_POST["fname"];
$mname = $_POST["mname"];
$lname = $_POST["lname"];
$comp = $_POST["comp"];
$email = $_POST["email"];
$add1 = $_POST["add1"];
$add2 = $_POST["add2"];
$phone1 = $_POST["phone1"];
$phone2 = $_POST["phone2"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$package = $_POST["package"];
$domain = $_POST["domain"];

?>



then the confirmation page in which the form data is correctly posted.



<left>
<form method="post" action="insert.php">
<br>
<br>
<br>
<br>
<br>
<b>Please review the following information for accuracy, If you spot a mistake, please go back and correct it before continueing.</b>
<br>
<br>
<br>
<br>
<br>
<b>First Name:</b>  <? echo"$fname"; ?>
<br>
<br>
<b>Middle Initial:</b>  <? echo"$mname"; ?>
<br>
<br>
<b>Last Name:</b>  <? echo"$lname"; ?>
<br>
<br>
<b>Company:</B>  <? echo"$comp"; ?>
<br>
<br>
<b>Email:</b>  <? echo"$email"; ?>
<br>
<br>
<b>Address 1:</b>  <? echo"$add1"; ?>
<br>
<br>
<b>Address 2:</b>  <? echo"$add2"; ?>
<br>
<br>
<b>City:</b>  <? echo"$city"; ?>
<br>
<br>
<b>State:</b>  <? echo"$state"; ?>
<br>
<br>
<b>Zip:</b>  <? echo"$zip"; ?>
<br>
<br>
<b>Contact Phone:</b>  <? echo"$phone1"; ?>
<br>
<br>
<b>Alt. Phone:</b>  <? echo"$phone2"; ?>
<br>
<br>
<b>Hosting Package:</b>  <? echo"$package"; ?>
<br>
<br>
<b>Site Name:</b>  <? echo"$domain"; ?>.adabraxix.net
<br>
<br>
<a href="http://www.adabraxix.net/viewpage.php?page_id=13">
<img src="http://www.adabraxix.net/images/banner/back.jpg"></a>


</left>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
If you are signing up for free hosting, Please select the initial 2 ads you wish to display. These will be placed in your site on either the left , right , top , or bottom and will be rotated out on a monthly basis.
<br>
<br>
<br>
<br>
<b>Small Box Ads
<br>
<img src="http://www.adabraxix.net/images/adds/eve8.jpg">
<input type="checkbox" value="eve8"name="ad1">

<img src="http://www.adabraxix.net/images/adds/eve14.gif">
<input type="checkbox" value="eve14"name="ad2">

<img src="http://www.adabraxix.net/images/adds/eve15.jpg">
<input type="checkbox" value="eve15"name="ad3">

<img src="http://www.adabraxix.net/images/adds/eve13.gif">
<input type="checkbox" value="eve13"name="ad4">

<img src="http://www.adabraxix.net/images/adds/eve12.gif">
<input type="checkbox" value="eve12"name="ad5">
<br>
<br>
<br>
<br>
<b>Banners and Sky Scrapers
<br>
<br>
<img src="http://www.adabraxix.net/images/adds/eve1.jpg">
<input type="checkbox" value="eve1"name="ad6">

<img src="http://www.adabraxix.net/images/adds/eve10.gif">
<input type="checkbox" value="eve10"name="ad8">

<img src="http://www.adabraxix.net/images/adds/eve11.jpg">
<input type="checkbox" value="eve12"name="ad9">

<img src="http://www.adabraxix.net/images/adds/eve2.gif">
<input type="checkbox" value="eve2"name="ad10">

<img src="http://www.adabraxix.net/images/adds/eve6.jpg">
<input type="checkbox" value="eve6"name="ad11">
<br>
<br>
<br>
<br>
<img src="http://www.adabraxix.net/images/adds/eve3.gif">
<input type="checkbox" value="eve3"name="ad12">
<br>
<br>
<br>
<br>

<input type="submit" name="submit" value ="Lets Finish This">
</form>



all the images in the second page are for my free package lol but Im wandering If on the form I maybe have the variable array in the wrong Place. Just a thought .
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

yes, all data is lost in the confirmation step. I'd add hidden input fields to transfer the data over, e.g:
<input type="hidden" name="fname" value="<?php echo $_POST["fname"]; ?>" />
0 replies
A
AthlonJedi
A
  • Junior Member, joined since
  • Contributed 30 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
answered
Junior Member

DOH!!!! Thank you very much for your help, Made hidden feilds for them all and it all works as intended . DUDE YOU ROCK !!! lol

guess we cant be genuses all the time.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 7 posts
  • Votes 0 votes
  • Topic users 2 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet