retrieving customer data

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dgabriel1982
Forum Newbie
Posts: 3
Joined: Tue Dec 08, 2009 12:18 am

retrieving customer data

Post by dgabriel1982 »

Hello,

Can someone help me create a page that would retrieve the data entered by customer in this <table width="96%" border="0" align="center" cellpadding="4" cellspacing"4">
<tr>
<td><p>
<p align="center">
<ifrmrame name="cwindow" style="border:none" width=767 height=220 "http:www.postque.com/secure/choose-id.php? view only"><iframe>
<br>
</td>
</p>
</tr>
</table>

I need to get the selected option from the three dropdown and price box. submit to a phpMyadmin and to echo to a different page(ex. orderpage, shopping cart).

Can someone plz help?
incubi
Forum Contributor
Posts: 119
Joined: Mon Dec 07, 2009 1:47 pm

Re: retrieving customer data

Post by incubi »

Sounds like standard database stuff. I good place to start is here.

http://www.w3schools.com/PHP/default.asp


incubi
dgabriel1982
Forum Newbie
Posts: 3
Joined: Tue Dec 08, 2009 12:18 am

Re: retrieving customer data

Post by dgabriel1982 »

incubi wrote:Sounds like standard database stuff. I good place to start is here.

http://www.w3schools.com/PHP/default.asp


incubi
Hey,

Thanks for the link, it's a great php resource site. For some odd reason I am still having trouble coding or finding an example of exactly what I'm trying to do. I might not have stated my question properly, I know I am going to need three pages for this setup. The first page(customer page) with the iframe link(src='') from an outside sever inside a table in the body of the page. A submit button to insert drop down selections into MySQL.
That's all I have for now on the first page.

Customer gets directed to second page(customer order detail page)

showing the result from drop down menu choices on first page(customer page)

I am new to web developing and need some serious help. In this setup the issue for me is where codes go to initiate interaction with outside server using the src link code and return selected data from drop down menus to me.

I hope this give you a better vision on my setup.

Thanks again.
incubi
Forum Contributor
Posts: 119
Joined: Mon Dec 07, 2009 1:47 pm

Re: retrieving customer data

Post by incubi »

I may be missing something here, are you trying to build a shopping cart?
Are you asking for help with just html or for php code?
If you're trying to code a shopping cart you're setting your sights high that's for sure! Security and liability to say the least. I would google a free one but for the basics this site is a start.

http://www.phpwebcommerce.com/

Or if I'm way off here do you have any PHP code you have done that you can post so I can see what you are talking about.

incubi
dgabriel1982
Forum Newbie
Posts: 3
Joined: Tue Dec 08, 2009 12:18 am

Re: retrieving customer data

Post by dgabriel1982 »

incubi wrote:I may be missing something here, are you trying to build a shopping cart?
Are you asking for help with just html or for php code?
If you're trying to code a shopping cart you're setting your sights high that's for sure! Security and liability to say the least. I would google a free one but for the basics this site is a start.

http://www.phpwebcommerce.com/

Or if I'm way off here do you have any PHP code you have done that you can post so I can see what you are talking about.

incubi
Hey incubi,

If you can place this link(http://www.postqueue.com/secure/choose- ... iew_only=1) into the address barand navigate to it. This is the code for that page with the country, region, exchange, and price selected.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
<!--
window.focus();
//-->
</SCRIPT>
<TITLE>DID Phone Number for incoming VoIP phone service</TITLE>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.price {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}

select {
font-size : 9px;
}
-->
</style>
<script src="http://www.postqueue.com/secure/includes/site.js" type="text/javascript"></script>
<script language="javascript">
<!--

function do_show(what) {
document.getElementById('options').style.display = 'none';
document.getElementById(what).style.display = '';
}

// -->
</script>
</HEAD>

<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>

<table id="options" style="display: none;" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="center"><p style="font-size:14px; font-weight:bold;">Choose an Option</p>
<br>
<input type="button" value="Keep my Existing Number" onClick="do_show('lnp')"><br><br>or<br><br>
<input type="button" value="Choose a New Phone Number" onClick="do_show('did')">
</td>

</tr>
</table>

<table id="did" style="display: ;" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><p style="font-size:14px; font-weight:bold;">Check Available DID Phone Numbers</p>
<table border="0" cellpadding="2" cellspacing="0" bordercolor="#999999">
<tr>
<td><strong>Country</strong></td>

<td><strong>Region</strong></td>
<td><strong>Exchange</strong></td>
</tr>
<tr>
<form name="form1" method="post" action="/secure/choose-did.php">
<td><select name="did_co"OnChange="this.form.submit();">
<option value="US" SELECTED>United States</option>
<option value="CA">Canada</option>

<option value="AR">Argentina</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="BH">Bahrain</option>
<option value="BE">Belgium</option>
<option value="BR">Brazil</option>
<option value="BG">Bulgaria</option>
<option value="CL">Chile</option>
<option value="CO">Colombia</option>

<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DO">Dominican Republic</option>
<option value="SV">El Salvador</option>
<option value="EE">Estonia</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="DE">Germany</option>

<option value="GR">Greece</option>
<option value="HU">Hungary</option>
<option value="IE">Ireland</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JP">Japan</option>
<option value="LV">Latvia</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>

<option value="MT">Malta</option>
<option value="MX">Mexico</option>
<option value="NL">Netherlands</option>
<option value="NZ">New Zealand</option>
<option value="NO">Norway</option>
<option value="PA">Panama</option>
<option value="PE">Peru</option>
<option value="PL">Poland</option>
<option value="PR">Puerto Rico</option>

<option value="RO">Romania</option>
<option value="SI">Slovenia</option>
<option value="ES">Spain</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="GB">United Kingdom</option>
</select></td>
</form>
<form name="form2" method="post" action="/secure/choose-did.php">

<td><select name="did_ci"OnChange="this.form.submit();">
<option value="1800">1800</option>
<option value="1866">1866</option>
<option value="1877">1877</option>
<option value="1888">1888</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>

<option value="CO" SELECTED>CO</option>
<option value="CT">CT</option>
<option value="DC">DC</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>

<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>

<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>

<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="TN">TN</option>

<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select></td>

</form>
<form name="form3" method="post" action="/secure/choose-did.php">
<td><select name="did_ex"OnChange="this.form.submit();">
<option value="1303">1303 - Keenesburg</option>
<option value="1303223">1303223 - Denver</option>
<option value="1303309">1303309 - Denver Sullivan</option>
<option value="13033092">13033092 - Denver Sullivan</option>
<option value="13033094">13033094 - Denver Sullivan</option>
<option value="13033099">13033099 - Denver Sullivan</option>

<option value="1303395" SELECTED>1303395 - Littleton</option>
<option value="13034163">13034163 - Denver</option>
<option value="1303482">1303482 - Lafayette Louisville</option>
<option value="1303552">1303552 - Arvada</option>
<option value="13035520">13035520 - Arvada</option>
<option value="1303557">1303557 - Aurora</option>
<option value="13035570">13035570 - Aurora</option>
<option value="1303558">1303558 - Brighton</option>
<option value="1303562">1303562 - Denver Southwest</option>

<option value="13035620">13035620 - Denver Southwest</option>
<option value="1303957">1303957 - Englewood</option>
<option value="1719">1719 - Weston</option>
<option value="1719289">1719289 - Pueblo</option>
<option value="1719387">1719387 - Colorado Springs</option>
<option value="1719423">1719423 - Pueblo</option>
<option value="1719553">1719553 - Pueblo</option>
<option value="1719694">1719694 - Colorado Springs</option>
<option value="1720">1720 - Longmont</option>

<option value="1720438">1720438 - Longmont</option>
<option value="1720943">1720943 - Denver</option>
<option value="1970">1970 - Yuma</option>
<option value="1970295">1970295 - Fort Collins</option>
<option value="1970366">1970366 - Glenwood Springs</option>
<option value="1970373">1970373 - Greeley</option>
<option value="1970497">1970497 - Montrose</option>
<option value="1970778">1970778 - Grand Junction</option>
<option value="19707783">19707783 - Grand Junction</option>

</select></td>
</form>
</tr>
<tr>
<tr>&nbsp;<BR></tr>
<td colspan="3">
<div align="center"><br><strong class="price">Price: <span style="color: #999900;">$7.95</span></strong>
</div>

</td>
</tr>
</table> </td>
</tr>
</table>

<table id="lnp" style="display: none;" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><p style="font-size:14px; font-weight:bold;">Keep you Existing Number</p>

<p>Please enter the phone number you would like to transfer below:</p>
<p></p>
<form name="frmPhone" action="/secure/choose-did.php" method="post" onSubmit="if(this.lnp_area_code.value.length != 3 || this.lnp_exchange.value.length != 3 || this.lnp_phone_number.value.length != 4 ) { alert('Please fill all the fields correctly. Your Phone Number must have the format ###-###-####'); return false; } else { return true; } ">
<table align="center">
<tr>
<td height="2" colspan="5" align="center"></td>
</tr>
<tr>

<td align="center"><input name="lnp_area_code" value="" type="text" onKeyUp="autotab(this, document.frmPhone.lnp_exchange)" size="3" maxlength="3" style="width:40px"/>
- </td>
<td align="center"><input name="lnp_exchange" value="" type="text" onKeyUp="autotab(this, document.frmPhone.lnp_phone_number)" size="3" maxlength="3" style="width:40px" />
- </td>
<td align="center"><input name="lnp_phone_number" value="" type="text" size="4" maxlength="4" style="width:60px" /></td>
</tr>
<tr>
<td height="40" colspan="3">

<div align="center">
<a href="javascript:void(0);" onClick="self.close(); return false;">
<img src="/images/cancel.gif" border="0" alt="Cancel"></a>
<input type="image" src="/images/select.gif" border="0" alt="Select">
</div> </td>
</tr>
</table></form>
</td>

</tr>
</table>
</BODY>
</HTML>



***** I Guess my question is how do I make the select button submit into a database table the selected option from the three dropdown menus , with the price result?

Then to call it back on a new page or the shopping cart. To answer your question yes, I will need a shopping cart. That is my next project, which I think is easier then what I'm trying to do in my opinion.

thanks again
dgabriel1982
incubi
Forum Contributor
Posts: 119
Joined: Mon Dec 07, 2009 1:47 pm

Re: retrieving customer data

Post by incubi »

Ok I think I understand better. I will have to assume a lot here.

1: You have a database and tables setup.
2: You’re using MySQL
3: You have the PHP in place to connect to the database.
4: You have a PHP function setup for the form submission.
5: You have a unique ID field in the table.
6: You have the security in place for the code.

So, if you’re looking to simply submit the three pull downs and call them back. The SQL is

Code: Select all

 
mysql_query("INSERT INTO the_table (FIELD1,FIELD2 , FIELD3) VALUES ('$did_co', '$did_ci', '$did_ex' ) ");
 
And to select them

Code: Select all

 
 
$sql = "SELECT FIELD1, FIELD2, FIELD3 FORM the_table WHERE your_ID_field= the_id_number";
    $results = mysql_query($sql);
    while ($row = mysql_fetch_array($results)) 
    {
        echo $row["FIELD1"];
        echo $row["FIELD2"];    
        echo $row["FIELD3"];
        
    }
 
 

Also, for the price you have it static in the html code you will need a variable for it. You may want to look at some database basics too.

http://www.w3schools.com/PHP/DEfaULT.asP

incubi
Post Reply