-
Posts
760 -
Joined
-
Last visited
Everything posted by joel24
-
try put in these 2 lines after /* $_POST */ print_r($_POST); exit(); this will let you see what is being posted and see if your message/subject is being posted.... can you post the response you get from this? and your FORM HTML.
-
you are missing a /* which would comment out the line. i.e. /* $HTTP_POST_VARS. */ and like thorpe said, change $HTTP_POST_VARS to $_POST is the code working now?
-
what does your $me; echo on the first page? put in the lines print_r($_POST); exit(); in the second page and you will see all the $_POST items in an array and you'll be able to debug from there. also on a side note, you should try and use $_POST and $_GET instead of $_REQUEST... in this case you'll be using $_POST.
-
try run this and it should help you debug it, it'll print all the variables in the $_POST array. and then it will echo the string you are putting into your database so you can check that its right. also on a side not, you shouldnt be using the $_POST in the SQL statement, you should put them into variables first and then pull them in... so you can do mysql_real_escape_string etc to them. <?php if ($con = mysql_connect("mydb.dbsite.com","dbname","dbpassword")) { mysql_select_db("dbname"); } else { die('Could not connect: ' . mysql_error()); } $opMode='gather'; //WHICH SECTION OF SCRIPT TO EXECUTE $strMsg=''; include('inc_arrays.php'); // GATHER DATA FROM THE FORM $usrFullName=@$_POST['full_name']; $usrCity=@$_POST['city']; $usrAddress1=@$_POST['address1']; $usrAddress2=@$_POST['address2']; $usrState=@$_POST['state']; $usrZip=@$_POST['zip']; $usrPhone=@$_POST['phone']; $usrAltPhone=@$_POST['altphone']; $usrEmail=@$_POST['email']; $usrAltEmail=@$_POST['altemail']; $usrTimeToContact=intval(@$_POST['time_to_contact']); $usrHowFindUs=intval(@$_POST['how_find_us']); if (isset($_POST['subedit'])) { $opMode='gather'; } if (isset($_POST['subapprove'])) { $sql = "INSERT INTO contact_info (full_name, address1, address2, city, state, zip, phone, altphone, email, altemail, time_to_contact, how_find_us) VALUES ('$_POST[full_name]','$_POST[address1]','$_POST[address2]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[phone]','$_POST[altphone]','$_POST[email]','$_POST[altemail]','$_POST[time_to_contact]','$_POST[how_find_us]')"; print_r($_POST); echo "<br />".$sql; exit(); $opMode='added'; header("Location:http://www.mywebiste.com/endpage.php"); exit; } else { $opMode='fail'; } } if (isset($_POST['subdone'])) { //NOW WE HAVE TO VALIDATE THE DATA $tmp='Please check: '; if ($usrFullName!='') { if ($usrAddress1!='') { if ($usrCity!='') { if (strlen($usrState)==2) { if ($usrZip!='') { if ($usrPhone!='') { if ($usrTimeToContact>0) { if ($usrHowFindUs>0) { $opMode='verify'; } else {$strMsg=$tmp.'How Did You Find Us?';} } else {$strMsg=$tmp.'Best Time To Contact?';} } else {$strMsg=$tmp.'Phone';} } else {$strMsg=$tmp.'Zip';} } else {$strMsg=$tmp.'State';} } else {$strMsg=$tmp.'City';} } else {$strMsg=$tmp.'Address (line 1)';} } else {$strMsg=$tmp.'Full Name';} } ?> <html> <head> <title>MY WEBSITE | CONTACT INFO</title> </head> <body> <form name="contact" id="contact" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p class="req"><b><?php echo $strMsg; ?></b></p> <table class="center"> <?php if ($opMode=='gather') { ?> <th colspan="8" class="headerlabel"><b>Step 1</b></th> <tr> <td colspan="2" class="labelcell"><label for="full_name">Full Name</label></td> <td colspan="2" class="fieldcell"><input type="text" name="full_name" size="40" tabindex="1" value="<?php echo stripslashes($usrFullName); ?>"></td> </tr> <tr> <td colspan="2" class="labelcell"><label for="address1">Address (Line 1)</label></td> <td colspan="2" class="fieldcell"><input type="text" name="address1" size="40" tabindex="2" value="<?php echo stripslashes($usrAddress1); ?>"></td> </tr> <tr><td colspan="8"> <input type="submit" tabindex="13" name="subdone" value="Verify" /></td></tr></table> <?php } else if ($opMode=='verify') { ?> <table> <th colspan="16" class="headerlabel"><b>Please verify your information below:</b></th> <tr> <td colspan="2" class="labelcell"><label for="full_name">Full Name</label></td> <td colspan="2" class="resultscell"><?php echo htmlentities(stripslashes($usrFullName)); ?><input type="hidden" name="full_name" value="<?php echo stripslashes($usrFullName); ?>"></td> </tr> <tr> <td colspan="2" class="labelcell"><label for="address1">Address (Line 1)</label></td> <td colspan="2" class="resultscell"><?php echo htmlentities(stripslashes($usrAddress1)); ?><input type="hidden" name="address1" value="<?php echo stripslashes($usrAddress1); ?>"></td> </tr> <tr> <td colspan="4"> <input type="submit" name="subedit" value="Back To Edit" /> or <input type="submit" name="subapprove" value="On To Step 2" /> </td> </tr> <?php } else if ($opMode=='added') { ?> <p class="submitmessage"><b>Thank You! One Of Our Representatives Will Be Contacting You Shortly!</b></p> <p class="submitmessage"><input type="button" value="Home" onclick="location.href='http://www.mywebsite.com/home.php'" /></p> <?php } else if ($opMode=='fail') { ?> <p class="submitmessage"><b>Internal Error! Your Information Could Not Be Saved, Please Email<a href="mailto:mymail@mywebsite.com?subject=Property and loan info">mymail@mywebsite.com</a></b></p><p class="submitmessage"><b>We Are Sorry For The Inconvenience.</b></p> <p class="submitmessage"><input type="button" value="Home" onclick="location.href='http://www.mywebsite.com/home.php'" /></p> <?php } else if ($opMode=='fatal') { ?> <?php } ?> </table> </form> </body> </html> <?php function buildSelect($arr,$sel) { $htm=''; foreach ($arr as $k => $v) { $htm.='<option value="'.$k.'"'.($k==$sel ? ' selected' : '').'>'.$v.'</option>'; } return $htm; } ?>
-
[SOLVED] Problems creating a URL with info from a database
joel24 replied to mike12255's topic in PHP Coding Help
change it to echo '<a href="' . urlEncode($row['Name']) . '">' . $row['wantedname'] . '</a><br >\n'; you should use ' instead of " when there is no php variables inside the quotes, otherwise PHP is still searching through it in case there is one. -
woops sorry, didnt have a good enough look at your code you have mysql_fetch_array twice. change get rid of the $info = mysql_fetch_array($data); line so its only Print "<table border cellpadding=3>"; while($info = mysql_fetch_array($data))
-
also check that your $table variable is being set... up the top put in $table = $_GET['user']; echo $table; exit(); and see what it echos.
-
whats the error you are getting? was going to tell you to edit out the user/pass for your database but you've already done so,
-
try this. if it doesn't work try changing $result = $db->query("SELECT * FROM articles_category WHERE cid='$cid'") or die(mysql_error()); to $result = mysql_query("SELECT * FROM articles_category WHERE cid='$cid'") or die(mysql_error()); <?php require 'global_header.php'; $cid = mysql_escape_string ($_GET["cid"]); $result = $db->query("SELECT * FROM articles_category WHERE cid='$cid'") or die(mysql_error()); if (!mysql_num_rows($result)) { echo "No Category with that ID exsists"; } else { $row = $db->fetch_array($result); ?> <form action="?mod=edit&cid=<?PHP echo $cid; ?>" method="post"> <table id="tablestyle"> <tr><td colspan="2" height="23" background="navbg.gif" class="nav" align="center"><b>Editing Category Details:</b></td> <tr><td bgcolor="#E6E6E6">Category ID:</td><td bgcolor="#E6E6E6"><input type="text" name="upcid" size="30" value="<?PHP echo $row['cid']; ?>"></td></tr> <tr><td bgcolor="#E6E6E6">Category Name:</td><td bgcolor="#E6E6E6"><input type="text" name="upcat" size="30" value="<?PHP echo $row['category']; ?>"></td></tr> <tr><td colspan="2" align="center" bgcolor="#E6E6E6"><input type="submit" value="Submit"></td></tr> <tr><td colspan="2" height="23" background="navbg.gif"></td></tr></table> <?php } //end if num rows require 'global_footer.php'; ?>
-
you're not counting the songs at all? or pulling the results into a variable..? <?php $data = mysql_query("SELECT DISTINCT AllBands FROM Allsongs WHERE SUBSTR(LCASE(AllBands),1,1) = LCASE('1') ORDER BY AllBands ASC LIMIT 1,50"); echo '<table width="100%">'; echo '<tr><td>Artists:</td><td># of songs:</td></tr>'; while($result = mysql_fetch_assoc($data)){ $_sql = mysql_query("SELECT DISTINCT(AllSongs) as SongCount FROM allsongs WHERE AllSongID='".$result['AllSongID']."'"); //count the number of rows returned by the previous SQL query $songCount = mysql_num_rows($_sql); echo '<tr>'; echo '<td>'.$result['AllBands'].'</td>'; echo '<td>[ <strong>'.$songCount.'</strong> Songs ]</td>'; echo '</tr>'; } echo '</table>'; ?>
-
can you copy / paste your complete code? everything there looks fine, your SQL statement isn't retrieving any rows... before the line $re = $db->query( etc etc put in echo $cid; exit(); and see what it echos... if the echo $cid; is echoing the ID as it should be, try change $re = $db->query("SELECT * FROM articles_category WHERE cid='$cid'"); to $re = $db->query("SELECT * FROM articles_category"); and execute the code (without the echo $cid; exit(); lines) and it should say "category does exist".. unless there are no rows in your articles_category table
-
replace mysql_fetch_row with mysql_num_rows...?
-
the php won't execute a function inside quotes, only echo variables. change it to: echo "<center><b>$item_prod_name</b></center> <HR width=80%> ".substr($item_short_desc,0,15)." <BR><BR> $item_prod_code <BR> <B>$item_retail</B></P> <BR></TD>";
-
use substr... http://au.php.net/substr i.e. substr($item_desc, 0, 15) would return the first 15 characters.
-
what were you trying to achieve by finding all teh warnings and errors? if you were trying to create a default error message etc, you can play around with set_error_handler() http://au.php.net/set_error_handler and trigger_error() http://au2.php.net/trigger_error
-
I'm making a site which users can sign up to and they'll be able to create an individual site for themselves and appoint users to their site etc... The sites will be running the same as each other, I'm just pondering my options as to how to set this up... With a single folder with the files - (say V1 for version one and V2 for version2)... and then a mass users list which has a "companyID" column and a version Column... and when the user logs in, there would then be two options, have tables which had all the separate companies data, but depending on the login, the user would only see their data... or individual tables for each company, and when the user logged in it would only fetch information from the relevant tables...? or... the other option, create new folders/files and complete new databases for each company which signs up.. and have them all running individually... Just want to get some feedback about Pros & cons... i realise that having all users using the same database would slow it down, but having individual setups would make it harder for updating...
-
what are the weird characters the page is producing?
-
let me get this right, you just want to group them into the dates and you have all the data in your columns? or do you have a table that has say 200 cars, maybe 15 ferrari's in it, and you want to list each distinct car brand and count how many types of each car there is?
-
try. <?php if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { print_r($_POST['adj']); exit(); } ?> and see what you get.. and also, check in the generated HTML to see that the SELECT values are showing.. i.e. $row['id'] isn't returning a NULL value.
-
do a "SELECT * FROM whateverTable ORDER BY DATE(date) DESC" (or ASC depending on what you want) then in the while loop that echos the data have something like $lastDate = ""; while($cars = mysql_fetch_array($carSQL)) { $date = $cars['date']; *** put in code to split date from time... using a date function or something) *** if ($date != $lastDate) { echo "<tr><td>Next Date Cars</td></tr>"; } echo "<tr><td>$cars['date']</td></tr>"; echo <tr><td>$cars['car']</td></tr>"; $lastDate = $date; } that splits up a single table and puts a new row in tho... you wanted new tables... you could have it start with a <table> in the html at the top.. then change echo "<tr><td>Next Date Cars</td></tr>"; to echo "</table><table>"; and after the while loop have a </table> in the html.
-
maybe have a states table also...? and then when you add tracks, you select a state... and the states table would look like stateID, name, abbreviation, hasTrack. and then pre-populate that state table with your 50 states, and when you add a track, the drop down menu for states will be populated from that table, and have the value as the stateID and then if that state's hasTrack column is 0, it will be set to 1. then when you list your states you can say "SELECT name FROM states WHERE hasTrack = 1"; .... then in the markers column link it to the state with stateID... i spose the state abbreviations will would work just aswell as ID numbers. does that make sense?
-
I don't really know exactly how your site is running, but wouldn't you be better off having a "track" column in the markers table, tinyInt 1/0. and if the state has a track, set it to 1, otherwise set it to 0? and then mysql "select name from markers where track = 1"
-
get jquery. www.jquery.com uses javascript n ajax in a nice simplified form put this in your head tag...? and get the jquery library from the jquery site... u can change fadeIn / fadeOut to toggleslide or slideUp / SlideDown etc etc.. look on the jquery site its mad and the $('.contentcontent') refer to classes. you could change it to $('#contentcontent') and change hte table cell to id="contentcontent" and it would do the same. the .showcontent button must have class .showcontent, or you can do the same as above for that... n same goes for the close button. <script type="text/javascript"> jQuery(document).ready(function() { // hide content on load... remove this line if you want it default shown. $('.contentcontent').hide(); $('.showContent').click(function(event) { event.preventDefault(); $('.contentcontent').fadeIn('normal'); }); //close button $('.close').click(function(event) { event.preventDefault(); $('.contentcontent').fadeOut('normal'); }); }); </script>
-
Have a problem with IE8, on a site i'm building I currently have the tables set with fixed headers / scrollable bodys... like in the demo http://www.webtoolkit.info/demo/jquery/scrollable/demo.html For this I am using the scrollable table plugin for jQuery, it works fine in FF, ie6 & ie7... but not in ie8... On a side not it doesn't work in opera or google chrome either, but I'm not worried about these browsers. Anyone else using it and having this problem? Even found a work-around? Or have another solution to scrollable headers... (I used CSS before but it was even worse trying to get one which worked across FF, IE6, IE7 etc.) link for the plugin is at http://www.webtoolkit.info/scrollable-html-table-plugin-for-jquery.html
-
else if (isset($_POST['Mamount']) < $gang['money']) wouldn't that line be returning if (true/false < $gang['money'] ??? change it to else if (isset($_POST['Mamount']) and $_POST['Mamount'] < $gang['money']) ...