PHP - Php Standard - Simple Else Issue - Help!
Hi, I'm trying to make an error message appear when a user misses a text field, or fills in an error. All the errors are sent to a form.php, this then sends the error message back to the current page. Here is the code I am using to retrieve the error message:
if($form->error = ("user")){ echo $form->error("user"); } if($form->error = ("pass")){ echo $form->error("pass"); } Which works fine, but I only want ONE error message to be displayed at a time. This IS what I want: There are two fields, user, and password. If the user fails to enter anything into both, only one error message will appear "Please enter your username" (which is what the form.php does). When the user fills in the username, but fails to fill in the password then it works, only one error message appears (as there is only one error to send) When the user fills in the password, but fails to fill in the username it also works, only one error message appears. Its just when the user fails to fill in either, it prints both error messages when I only want it to print the 'user' error message. Please help, Thanks Similar TutorialsI'd like to write - or acquire - code that displays a simple table (name, phone number, email address, plus a comments field) on a web page in a password-protected page and allows a user to add his own information, update it or delete it. I figure hundreds of people and companies have written something like this so I'd like to find either an example I can imitate or even an existing package that I can simply customize to the specifics for my own table. Can anyone help me with that? Or am I going to have to reinvent the wheel for the gazillionth time and write it myself? Hello, I don't have any php knowledge and am having a hard time trying to implement the following: - a drupal node is getting a numeric parameter with the URL in the following form "http://the.url/?X=123" - what I want is for the script to check if the value has been passed with the URL, then use it in a form... if the entered URL was "http://the.url" without the X variable, then use a default value of 321. <?php $_GET['X']; if (isset($X)) { print $X ; } else print "321" ?> Thanks in advance for your help. I have this simple piece of code. I am using GET[] to retrieve the catID from URL, then match it and set a backgorund image, some backgorund images can change per catID variable. When selected or clicked on. It is not working, it is producing the catId in ech $_Get[], but not matching it with $filename to set correct Image. Ex. Browser catID may == 1, it code displays catid = 1, file name = deals_2.jpg. This is worng. should be catid = 1 , filename = 1. PLEASE HELP, missing something. Code: [Select] <?php $imgpath = '/shushmedeals/templates/shushme_deals/images/'; //$bgimgID = $item->id; $bgimgID = isset($_GET['categoryId']); $bgimgID = $_GET['categoryId']; echo $bgimgID; //echo 'shoot her eman'; //echo $imgpath; if($bgimgID){ $bgimgID = 1; $filename = '/shushmedeals/templates/shushme_deals/images/bg_home.jpg'; } if($bgimgID = 2){ $filename = '/shushmedeals/templates/shushme_deals/images/shushme_bg_img1.jpg'; } if($bgimgID = 3){ $filename = '/shushmedeals/templates/shushme_deals/images/shushme_bg_img2.jpg'; } else { $filename = '/shushmedeals/templates/shushme_deals/images/shushme_bg_img3.jpg'; } if($filename){ echo '<br>'.$filename; // SET COOKIE //setcookie('bgimg', $filename); //echo $_COOKIE['bgimg']; } else { echo "There is no Background for this category"; // DO NOT SET COOKIE } // Print an individual cookie echo $_COOKIE["location"]; ?> I am trying to recursively pull records from a database to write to a csv. There are three test rows of data in my table (and no not including the table headers). The only issue is i can’t seem to get my for loop to display all the records – it only displays the last 2 rows so i’m very confused. Anyone suggest why this isn’t working? Code: [Select] $num_rows = mysql_num_rows($export); for ($i=0; $i <= $num_rows; $i++ ) { $row = mysql_fetch_row($export); echo $row[1] . $row[2] . $row[3] . $row[4] . $row[5] . $row[6] ."<br/>"; echo $i; } Incidentally the query is just a fetch all from datasbase. Anyone see where i'm going wrong? Thanks, drongo Hi All, I have a simple 'delete record' code that is not working. Would someone please take a gander at it and let me know if they see anything wrong that would prevent it from actually deleting a record. Code: [Select] <?php //connects to the database include ('db_connect.php'); //post variable $pk = $_POST['pk']; //MySQL code to query ---- 'contacts' = table & 'primary_key' = record id # $deleteContact = "DELETE FROM `contacts` WHERE `primary_key` = ".$pk." LIMIT 1"; //excutes query to MySQL $res = mysqli_query($link,$deleteContact); //close connection to database mysqli_close($link); ?> Any help would be great. Thank you. Error... Parse error: syntax error, unexpected T_ELSE in /home/smileits/public_html/space/webmin/install.php on line 15 Code... Code: [Select] <?if ($_GET['a'] == "") {?><br><br><div align="center"><h2>Welcome to aWebBB</h2><br><br>After editing the configuration file located at /forum/config.php and created a database named 'awebbb_forum' (or different) please click <a href="install.php?a=install">here</a> to install.<br></div><?} else { }if ($_GET['a'] == "install") {echo "Installing MYSQL Tables...<br>";include "../config.php";$db = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = 'CREATE TABLE `fcat` ( `id` int(11) NOT NULL auto_increment, `category` varchar(50) default NULL, `description` varchar(250) default NULL, PRIMARY KEY (`id`))';$result = mysql_query($query); echo "Created Categories Table<br>";$query2 = 'CREATE TABLE `flist` ( `id` int(11) NOT NULL auto_increment, `tid` varchar(50) default NULL, `categories` varchar(30) default NULL, `tname` varchar(100) default NULL, `poster` varchar(50) default NULL, `date` date default NULL, PRIMARY KEY (`id`))';$result2 = mysql_query($query2); echo "Created Thread List Table<br>";$query4 = 'CREATE TABLE `forum` ( `id` int(11) NOT NULL auto_increment, `tid` varchar(50) default NULL, `categories` varchar(30) default NULL, `tname` varchar(100) default NULL, `poster` varchar(30) default NULL, `fpost` text, `sig` varchar(150) default NULL, `avatar` varchar(150) default NULL, `time` time default NULL, `date` date default NULL, PRIMARY KEY (`id`))';$result4 = mysql_query($query4); echo "Created Main Fourm Table<br>";$query5 = 'CREATE TABLE `prefs` ( `id` int(11) NOT NULL auto_increment, `sitename` varchar(99) default NULL, `forumname` varchar(99) default NULL, `sitetitle` varchar(99) default NULL, `menulink` varchar(11) default NULL, `normallink` varchar(11) default NULL, `defimage` varchar(150) default NULL, `defsig` varchar(150) default NULL, `backcolor` varchar(20) default NULL, `msitecolor` varchar(20) default NULL, `siteurl` varchar(150) default NULL, `headimage` varchar(150) default NULL, `hiwidth` varchar(4) default NULL, `hiheight` varchar(4) default NULL, `forumcolor` varchar(11) default NULL, `normaltext` varchar(11) default NULL, `copyright` varchar(150) default NULL, `email` varchar(100) default NULL, `adenable` varchar(11) default NULL, `adcode` text, `adlocation` varchar(20) default NULL, PRIMARY KEY (`id`))';$result5 = mysql_query($query5); $query7 = "INSERT INTO `prefs` VALUES (1, 'Site Name', 'Forum Name', 'Title of your site', 'white', 'blue', 'images/world.jpg', 'Love Life', 'white', 'blue', '', 'images/logo1.jpg', '700', '80', 'white', 'black','','','','','');"; mysql_query($query7); echo "Created Preferences Table<br>";$query6 = 'CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `level` char(2) default NULL, `username` varchar(20) default NULL, `password` varchar(20) default NULL, `emailadd` varchar(50) default NULL, `fullname` varchar(40) default NULL, `country` varchar(30) default NULL, `date` date default NULL, `sig` varchar(150) default NULL, `avatar` varchar(150) default NULL, PRIMARY KEY (`id`))';$result6 = mysql_query($query6); echo "Created Users Table<br>"; $query7 = 'CREATE TABLE `menu` ( `id` int(11) NOT NULL auto_increment, `bname` varchar(50) default NULL, `link` varchar(200) default NULL, PRIMARY KEY (`id`) )'; $result7 = mysql_query($query7); echo "Created Menu Table<br>";echo '<meta http-equiv="refresh" content="1;url=install.php?a=users">'; } else { }if ($_GET['a'] == "users") {?>Please Create the Administrative User Account:<br><br><style type="text/css"><!--div.error-box {width:200px; background:pink; margin-top: 2px; border: 1px solid red; text-align: center;}//--></style><?$a=$_GET['b'];if ($a == "skyreg" ) {$fullname=$_POST['fullname'];$username=strtolower($_POST['username']); $password1=$_POST['password1'];$password2=$_POST['password2'];$emailadd=$_POST['emailadd'];$country=$_POST['country'];if ($fullname == "") {$fullnamebox="<div class=\"error-box\">";$fullnamebox1="</div>";} else { }if ($username == "") {$usernamebox="<div class=\"error-box\">";$usernamebox1="</div>";} else { }if ($password1 == "") {$pword1box="<div class=\"error-box\">";$pword1box1="</div>";} else { }if ($password2 == "") {$pword2box="<div class=\"error-box\">";$pword2box1="</div>";} else { }if ($emailadd == "") {$emailaddbox="<div class=\"error-box\">";$emailaddbox1="</div>";} else { }if ($country == "") {$countrybox="<div class=\"error-box\">";$countrybox1="</div>";} else { }if ($fullname == "" OR $username == "" OR $password1 == "" OR $password2 == "" OR $emailadd == "" OR $country == "") {$errormessage="<font color=\"red\">Please Fill in all Feilds.</font><br>";} else { include "../config.php";$db12 = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query12 = "SELECT username FROM users WHERE username = '$_POST[username]'"; $result12 = mysql_query($query12); while($r=mysql_fetch_array($result12)) { $username12=$r["username"]; }if ($username12 == $username) {$errormessage3="<font color=\"red\">The username chosen is in use, choose another.</font>";} else { if ($password1 == $password2) {$fullname=$_POST['fullname'];$username=strtolower($_POST['username']); $password=$_POST['password1'];$emailadd=$_POST['emailadd'];$schoolyear=$_POST['schoolyear'];$country=$_POST['country'];$defsig1=$_POST['defsig'];$defimage1=$_POST['defimage'];include "../config.php"; // As you can see we connected to the database with config$db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = "INSERT INTO users(level, username, password, emailadd, fullname, country, date, sig, avatar) VALUES('1', '$username','$password','$emailadd','$fullname', '$country', now(), '$defsig1', '$defimage1')"; mysql_query($query); echo "Account Created";echo '<meta http-equiv="refresh" content="1;url=install.php?a=done">'; mysql_close($db); } else {$errormessage2="<font color=\"red\">Passwords Entered do not Match.</font>";}}mysql_close($db12);}} else { }if ($a != "skyreg" OR $a != "reg") { ?><div align="center"><?=$errormessage;?><?=$errormessage2;?><?=$errormessage3;?><br><form method="post" action="install.php?a=users&b=skyreg"><input type="hidden" name="defimage"><input type="hidden" name="defsig"><?=$fullnamebox;?>Full Name:<br><input type="text" name="fullname"><br> <?=$fullnamebox1;?><?=$usernamebox;?>Username:<br><input type="text" name="username"><br> <?=$usernamebox1;?><?=$pword1box;?>Password:<br><input type="password" name="password1"><br> <?=$pword1box1;?><?=$pword2box;?>Retype Password:<br><input type="password" name="password2"><br> <?=$pword2box1;?><?=$emailaddbox;?>E-mail Address:<br><input type="text" name="emailadd"><br> <?=$emailaddbox1;?><?=$countrybox;?>Country:<br><input type="text" name="country"><br> <?=$countrybox1;?><input type="reset" value="Clear Form"> <input type="submit" value="Register"></form></div><? } else { }} else { }if ($_GET['a'] == "done") {?><div align="center"><br><br>All done!!!<br><br>Please procede to the <a href="index.php">Admin section</a> and Edit the <a href="pref_edit.php">site preferences</a>.<br><br><font color="red"><h2>Remember to delete install.php AND upgrade.php for security reasons!!!</h2></font></div><?} else { }?> Hi All, I'm trying to debug my first few lines of PHP where I have all my "checks" to make sure someone is logged in. I have this code all by itself and it is still not executing. This is the only page that I'm having trouble with. header('Location: login.php?logout=1'); I cant figure out why im having this problem. i stuck this at the top of my page on its own and it wont update the row to read Code: [Select] <?php mysql_query("UPDATE pm SET read= 'read' WHERE pm_id = '".mysql_real_escape_string($_GET['pm_id'])."'"); ?> I echo $_GET['pm_id']; and that turn out correct and the number matches the pm_id on the row. everything is lowercase I typed read manually into the column and echo that and it showed read also I have this same exact line of code on another script that works fine. does someone see something im over looking? this is driving me crazy http://localhost/stargate/users/view.php?pm_id=1376672&inbox=2 Code: [Select] <?php require("menu.php"); ?> <html> <body> <?php mysql_query("UPDATE pm SET read= 'read' WHERE pm_id = '".mysql_real_escape_string($_GET['pm_id'])."'"); ?> </body> </html> I have the simple code below which seems to have worked on forms from a contact page on a website. Unfortunately, it seems to only send the forms if all fields are entered. I have played with the code but cannot seem to get it to send any field that has been completed on submit. Can someone help please? <?php $emailAddress = "bigL@gmail.com"; $thankyouPage = ""; session_start(); if (!empty($_POST)) { foreach ($_POST as $key=>$value) { $_POST[$key] = stripslashes($_POST[$key]); $_POST[$key] = htmlspecialchars($_POST[$key],ENT_QUOTES); } } if (isset($_POST['send']) AND isset($_SESSION['msgCount'])) { if ($_SESSION['msgCount'] >= "3") $alert = "Only 3 messages can be s +ent per session."; if (empty($alert)) { $_SESSION['msgCount']++; putenv('TZ=EST5EDT'); // eastern time $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n" +; $message = "<table cellpadding='5' border='1'>"; foreach ($_POST as $key => $value) if (!preg_match("(^send)",$key)) { $value = wordwrap($value,65,"<br />"); $message .="<tr><td><b>$key</b></td><td>$value</td></tr>"; } $message .= "</table>"; $message .= "<br />Time of the message: ".date(" F d h:ia")."<br +/>"; $message .= "IP Address: ".$_SERVER['REMOTE_ADDR']."<br />"; $message .= "Hostname: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."< +br />"; $subject = $_SERVER['HTTP_HOST']." Message"; mail($emailAddress,$subject,$message,$headers); if (!empty($thankyouPage)) { header('location: '.$thankyouPage); die(); } unset($_POST); $alert = "Your enquiry has been sent, we will respond as soon as p +ossible."; } } if (!isset($_SESSION['msgCount'])) $_SESSION['msgCount'] = 0; ?> The code below works echo '<script language="javascript">'; echo 'top.location.href = "/breaking-news/bsnewsstorygoeshere/";'; echo '</script>'; this also works echo '<script language="javascript">'; echo 'top.location.href = "http://anywebsite.com";'; echo '</script>'; the problem, is I have a URL listed in a url variable that can be retreived via $_GET['url'] my question is how to get that variable into the above code? I've tried echo '<script language="javascript">'; echo "top.location.href = \"$_GET['url']\";"; echo '</script>'; but that doesnt seem to work, can anyone advise? like contact form is there a help standard you guys might suggest? This is the simplest of forms, but it has no character. It is the type I use in everything. form1.php <html> <head> </head> <body> <?php // Connect to database===================================================== include("connect_db.php"); // retrieve form data ====================================================== $id = $_POST['id']; // sending query =========================================================== $query = "SELECT ama,model_name,model_mfg,wingspan,engine,decibels FROM airplanes WHERE id='$id'"; if( !$result = mysql_query($query) ) { echo "<br>Query $query<br>Failed with error: " . mysql_error() . '<br>'; } else { $fetch = mysql_fetch_array( $result ); } // $fetch = mysql_fetch_array(mysql_query("SELECT ama,model_name,model_mfg,wingspan,engine,decibels FROM airplanes // WHERE id='$id'")); // Output form with retrieved data ========================================== ?> <h3>Change the data and then click the CHANGE button</h3><br> <form name="myForm" action="delete_airplanes.php" onsubmit="return validateForm()" method="post"> ID #:<input type="text" name="id" value="<?=$fetch[id]?>" /><br> AMA #:<input type="text" name="ama" value="<?=$fetch[ama]?>" /><br> Model Name:<input type="text" name="model_name" value="<?=$fetch[model_name]?>" /><br> Model Mfg:<input type="text" name="model_mfg" value="<?=$fetch[model_mfg]?>" /><br> Wingspan:<input type="text" name="wingspan" value="<?=$fetch[wingspan]?>" /><br> Engine:<input type="text" name="engine" value="<?=$fetch[engine]?>" /><br> Decibels:<input type="text" name="decibels" value="<?=$fetch[decibels]?>" /><br><br> <input name="submit" id="submit" value="CHANGE!" type="submit"> </form> <br> <body> </html> I would love to be able to get this form to work. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Enter Airplane Data</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="language" content="en" /> <style type="text/css"> .focus { background: #FEF1C1; } .class123-label { font-family: Verdana; font-size: small; } .class123-sidebyside { float:left; margin:0 5px 0 0;} .class123-twocol { float:left; width:45%; margin:0 5px 0 0;} .class123-threecol { float:left; width:30%; margin:0 5px 0 0;} .class123-likert_style_li { display:inline-block; vertical-align:middle; text-align:center; top:0px; padding:2px; width:64px; height:50px; margin:0px; margin-right:1px; margin-bottom:1px; font:11px/18px verdana; background:#ddd; zoom:1; *display:inline; } .class123-likert_style_li2 { display:inline-block; vertical-align:middle; text-align:center; top:0px; padding:2px; width:64px; height:50px; margin:0px; margin-right:1px; margin-bottom:0px; font:12px/18px verdana; background:#fff; zoom:1; *display:inline; border-top:1px solid #ddd; } .fontbold { font-weight: bold; } .fontitalic { font-style: italic; } .requiredspan { font-family: Verdana; font-size:10px; color:#f00; } </style> </head> <body style="background-color: rgb(138, 174, 222); direction: ltr;"> <div style="height: 50px;"> </div> <center> <table style="border-collapse: collapse;" id="AutoNumber1" border="0" cellpadding="0" cellspacing="0" width="658"> <tbody> <tr> <td class="tdborder" colspan="3" width="658"> <img alt="shadow" class="tdimagesus" src="/templates/cache/dynamicimage-1-1560BD.png" height="9" width="100%" /> </td> </tr> <tr> <td height="38" width="4"> </td> <td class="tdheader" style="border-style: solid solid none; border-color: rgb(1, 76, 169) rgb(1, 76, 169) -moz-use-text-color; border-width: thin thin medium;" bgcolor="#1560bd" height="38" width="650"> <img alt="logo" src="http://www.123contactform.com/templates/logos/computers_anvelope_white.png" align="left" /> </td> <td height="38" width="4"> </td> </tr> <tr> <td height="171" width="4"> </td> <td class="tdmain" style="border-style: none solid; border-color: -moz-use-text-color rgb(1, 76, 169); border-width: medium thin; padding-right: 10px;" bgcolor="#ffffff" height="171" width="650"> <div class="selector-off"> <center> <script type="text/javascript"> <!-- function InputActions(field,id) { var i=1; var lid="none"; for (i=1;i<=100;i++) { lid='row'+i; lidsec='rowsec'+i; if (document.getElementById(lid) != null) { if (lid==id) { document.getElementById(lid).className='focus'; if (document.getElementById(lidsec) != null) document.getElementById(lidsec).className='focus'; } else { document.getElementById(lid).className=''; if (document.getElementById(lidsec) != null) document.getElementById(lidsec).className=''; } } } } //--> </script> <form class="form" action="http://www.123contactform.com/contact-form-crmamx-122034.html" method="post" enctype="multipart/form-data"><input name="action" value="verify" type="hidden" /> <table style="min-width: 250px;" cellpadding="4"> <tbody> <tr id="row1"> <td style="text-align: left;" valign="top"><label class="class123-label" id="id123-title684273" for="id123-control684273">Name:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td style="" align="left"><input id="id123-control684273" name="control684273" onclick="InputActions(this,'row1');" onkeyup="InputActions(this,'row1');" onchange="" value="" size="20" type="text" /> </td> </tr> <tr id="row2"> <td style="text-align: left;" valign="top"><label class="class123-label" id="id123-title684275" for="id123-control684275">Subject:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td style="" align="left"><input id="id123-control684275" name="control684275" onclick="InputActions(this,'row2');" onkeyup="InputActions(this,'row2');" onchange="" value="" size="20" type="text" /> </td> </tr> <tr id="row3"> <td style="text-align: left;" valign="top"><label class="class123-label" id="id123-title684281" for="id123-control684281">Model Name:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td style="" align="left"><input id="id123-control684281" name="control684281" onclick="InputActions(this,'row3');" onkeyup="InputActions(this,'row3');" onchange="" value="" size="35" type="text" /> </td> </tr> <tr id="row4"> <td style="text-align: left;" valign="top"><label class="class123-label" id="id123-title684286" for="id123-control684286">Model Mfg:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td style="" align="left"><input id="id123-control684286" name="control684286" onclick="InputActions(this,'row4');" onkeyup="InputActions(this,'row4');" onchange="" value="" size="35" type="text" /> </td> </tr> <tr id="row5"> <td style="text-align: left;" valign="top"><label class="class123-label" id="id123-title684287" for="id123-control684287">Wingspan:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td style="" align="left"><input id="id123-control684287" name="control684287" onclick="InputActions(this,'row5');" onkeyup="InputActions(this,'row5');" onchange="" value="" size="35" type="text" /> </td> </tr> <tr id="row6"> <td style="text-align: left;" valign="top"><label class="class123-label" id="id123-title684288" for="id123-control684288">Engine Mfg/Size:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td style="" align="left"><input id="id123-control684288" name="control684288" onclick="InputActions(this,'row6');" onkeyup="InputActions(this,'row6');" onchange="" value="" size="35" type="text" /> </td> </tr> <tr id="row7"> <td style="text-align: left;" valign="top"><label class="class123-label" id="id123-title684289" for="id123-control684289">Decibel Reading:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td style="" align="left"><input id="id123-control684289" name="control684289" onclick="InputActions(this,'row7');" onkeyup="InputActions(this,'row7');" onchange="" value="" size="35" type="text" /> </td> </tr> <tr id="row8"> <td style="text-align: left;" valign="top"><label class="class123-label" for="id123-captcha" id="verifno">Verification No.:</label><span class="requiredspan customspan" title="Required field">*</span></td> <td align="left" valign="top"><input id="id123-captcha" onclick="InputActions(this,'row8');" onkeyup="InputActions(this,'row8');" name="txtNumber" value="" size="16" type="text" /></td> </tr> <tr> <td align="right"><a title="Don't know why you have to enter this verification number? Click here!" href="http://www.123contactform.com/faq.html#q1" onclick="window.open('http://www.123contactform.com/faq.html#q1','_blank','width=740, height=90, left=' + (screen.width/2-370) + ', top=250');return false;"><img src="http://www.123contactform.com/img/help_icon.gif" alt="contact form faq" border="0" /></a></td> <td align="left"><img alt="verification image" src="http://www.123contactform.com/random.php" /></td> </tr> <tr> <td></td> <td align="left"><input class="class123-button" id="id123-button-send" value="Send email" type="submit" /></td> </tr> </tbody> </table> <div style="height: 1px; display: none; visibility: hidden;"> <input name="email" type="text" /></div> </form> </center> </div> </td> <td height="171" width="4"></td> </tr> </tbody> </table> </center> </body> </html> Of course I did not write this. I have never used a form before built as a table, only like the form1.php 1. Does this form work in the same way? 2. I want to retrieve a record from the db and display it in this form. Do I do it in the same way as in form1.html with a value=? 3. If the above is true then I would assume (that always gets me in trouble) that in my next program (update_db.php) I would capture the input data the same. Thanks The raw output is this.. full example: http://instant.simplyhired.com/a/jobs/xml-v1/l-06238/q-engineer/ws-100/si-0/fdb-21/sb-rd/mi-10 I can generally get the value of this stuff.. like if I wanted the "jt" line I can get ENGINEER, and the rest of the data.. what i am having trouble with is getting the attribute (i think thats the right term for this with XML). For example the "src" line it as an attribute "url=" I am trying to figure out how to get that value.. Below is a sample of the raw.. and below that is the code I am working with to load up the XML. I know theres simple_xml but in my case thats not an option so I am working on slightly custom work (as little as it is). Code: [Select] <r> <jt>ENGINEER</jt> <cn url="">Soldream</cn> <src url="http://instant.simplyhired.com/a/job-details/view/jobkey-5109.J3H3036RVZPZ4RFRRKR/jp-0/hits-70?aff_id=2512">CareerBuilder</src> <loc cty="Tolland" st="CT" postal="06084" county="" region="" country="US">Tolland, CT</loc> <ls>2011-02-20T13:28:39Z</ls> <dp>2011-02-18T08:00:00Z</dp> <e>Engineer/CNC Machinist Tolland CT2429177 Aerospace MFG Co. seeks MFG/Design Engineer &amp; CNC Machinist with 5+ years of experience in aerospace manufacturing. Duties for engineers include developing new processes, drafting, and CNC programming. CNC Machinist should have knowledge of FANUC control. Send resume to...</e> <af></af> <pl url=""/> </r> $feedURL = 'http://instant.simplyhired.com/a/jobs/xml-v1/l-06238/q-engineer/ws-100/si-0/fdb-21/sb-rd/mi-10'; $doc = new DOMDocument(); $doc->load($feedURL); $arrFeeds = array(); foreach ($doc->getElementsByTagName('r') as $node) { $itemRSS = array ( 'title' => $node->getElementsByTagName('jt')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getAttributeNode('src'), 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, 'creator' => $node->getElementsByTagName('creator')->item(0)->nodeValue, 'permaz' => $node->getElementsByTagName('guid')->item(0)->nodeValue ); array_push($arrFeeds, $itemRSS); //print_r($arrFeeds); } array_unique($arrFeeds); ?> I am looking to finally move to a popular coding style. Anyone know any great ones I should look into? So far I have looked into PEAR. Thanks! i am trying to build a payment gate way library do you think this is the best way of going about it requirements code to be flexible for different naming conventions to conform with standards not to break why i am thinking of doing it this way one application could have for addressline1 as add_1 while i different app will have it as add_line_1 $test2 = "yay"; $test = 'a:1:{s:6:"teatme";s:5:"test2";}'; // think of this a a db field $test = unserialize($test); echo"<pre style=\"text-align:left;\">"; print_r($test); echo"</pre>"; foreach ($test as $key => $value) { $test[$key] = $$value; } echo"<pre style=\"text-align:left;\">"; print_r($test); echo"</pre>"; please give us your thoughts This topic has been moved to PHP Math Help. http://www.phpfreaks.com/forums/index.php?topic=320840.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=346652.0 I'm trying to connect to a SOAP API using PHP-SOAP. The problem is that the API is not adhering to the SOAP standard entirely. The SOAP Headers XML which the SOAP client needs to generate are as follows: Code: [Select] <SOAP-ENV:Header> <TargetVolume>foo</TargetVolume> </SOAP-ENV:Header> The problem is that the PHP SoapHeader class requires namespaces to be set for SOAP Header child elements (as in the standard). My code goes: Code: [Select] $ns = 'http://some.namespace.com'; $header = new SoapHeader($ns,'TargetVolume','foo'); $soapClient->__setHeaders($header); which produces: Code: [Select] <SOAP-ENV:Header> <ns1:TargetVolume>foo</ns1:TargetVolume> </SOAP-ENV:Header> Unfortunately 1. the SOAP API I'm using doesn't accept the ns1 namespace - or any namespace 2. The SoapHeader constructor does not accept NULL as its first parameter 3. I can't change the API! This is not a bug in PHP. See the discussion at http://bugs.php.net/bug.php?id=31755 which details that it's invalid in SOAP to use a namespace here. I am stuck in between a rock and a hard place with finding a work-around for this problem: to somehow get PHP-SOAP to send the required non-standard header to the API. Can anybody help? I am currently working on my PHP/MySQL driven website. However, I have read in recent weeks that there are a number of security measures which need to be taken and one of them is sanitising input to prevent html/MySQL injection into a database. So I was wondering if there is an 'industry standard' for sanitising PHP. For example, if a website only want there database to be searched by letters or numbers do they use a specific code? I have found one based on numbers (for ID numbers) but I cant find on one based on letters. I found this but it is quite complicated and looks very different to the guide I found on YouTube. so is there an industry standard which blocks people using any other code than numbers or letters? http://bobby-tables.com/php.html I was also wondering is there are anyother security measures I need to be aware of when using PHP? |