Spraban9 Posted March 20, 2013 Share Posted March 20, 2013 (edited) hi friends this is save coding but this not working if i click submit button not response all data show in address bar like this what is the solution for this problem localhost/cleanred/phoneadsup.php?make=nokia&model=800&name=praban&camera=3&inmemo=8+GB&exmemo=5+GB&display=LCD&os=window&price=20000&title=car+for+sale&address=kokuvil&city=colombo&description=ssssss&contact=0778459623&submit=Submit <?php if( $_POST['name'] != '' && $_POST['make'] != '' && $_POST['model'] != '' && $_POST['camera']!='' && $_POST['inmemo'] != '' && $_POST['exmemo'] != '' && $_POST['display'] != '' && $_POST['os']!='' && $_POST['price'] != '' && $_POST['title'] != '' && $_POST['city'] != '' && $_POST['address'] != '' &&$_POST['description'] != '' && $_POST['contact'] != '') { $name = $_POST['name']; $make = $_POST['make']; $model = $_POST['model']; $camera_mp = $_POST['camera']; $intermem = $_POST['inmemo']; $extermem = $_POST['exmemo']; $display = $_POST['display']; $os = $_POST['os']; $price = $_POST['price']; $title = $_POST['title']; $address = $_POST['address']; $city = $_POST['city']; $description = $_POST['description']; $contact = $_POST['contact']; $postdate = date("F j, Y"); echo "ok datat"; include("include/connection.php"); /* $sql=mysql_query("select name from customer where user='$ses_sql' "); */ $query = mysql_query("INSERT INTO mobile ( name ,make ,model ,camera_mp ,intermem ,extermem ,display ,os ,price ,title ,city ,address ,description ,contact ,postdate) VALUES ('".$name."','".$make."', '".$model."' ,'".$camera_mp."','".$intermem."','".$extermem."','".$display."','".$os."','".$price."','".$title."','".$city."','".$address."' ,'".$description."','".$contact."','".$postdate."' )"); echo $query; if($query){ $saved= " Enter the Verification code from your phone "; } else { $saved= "Cannot send Confirmation Verfication code to your contact number"; } }?> <label id="dis"> <?php echo $saved?> </label><br> <form name="frmphoneads" id="frmphoneads" action="phoneadsup.php"> <div id="form"> <h2>Upload Mobile phone Ads</h2> <table width="534" height="422" id="font"; > <tr> <td width="115" height="35"><label class="style9"> Make</label></td> <td width="407"><select name="make" width="250" > <option value="select" selected="selected">Select a type</option> <option value="nokia"> Nokia </option> <option value="sonye"> Sony Ericssion </option> <option value="Samsung"> Samsung </option> <option value="Motorola"> Motorola </option> <option value="lg"> LG </option> <option value="HTC"> HTC </option> <option value="Micromax"> Micromax </option> </select> </td> </tr> <tr> <td height="38"><label class="style9">Model</label></td> <td><input name="model" type="text" value="" /> <input name="name" type="text" value="" /></td> </tr> <tr> <td height="34"><label class="style9">Camera(MP)</label></td> <td><input name="camera" type="text" value="" width="150"/></td> </tr> <tr> <td height="34"><label class="style9">Internal Memory</label></td> <td><input name="inmemo" type="text" value="" width="150"/></td> </tr> <tr> <td height="34"><label class="style9">External Memory</label></td> <td><input name="exmemo" type="text" value="" width="150"/></td> </tr> <tr> <td height="34"><label class="style9">Display</label></td> <td><input name="display" type="text" value="" width="150"/></td> </tr> <tr> <td height="34"><label class="style9">Operating system</label></td> <td> <select name="os"> <option value="select" selected="selected" width="250">Select a o/s</option> <option value="window">Windows mobile</option> <option value="symbian">Symbian</option> <option value="android">Android</option> <option value="belle">Belle</option> </select></td> </tr> <tr> <td height="62"><label class="style9"> Price</label></td> <td><input name="price" type="text" value="" /></td> </tr> <tr> <td width="115" height="35"><label class="style9"> Ads title</label></td> <td width="407"><input name="title" type="text" value="" /></td> </tr> <tr> <td height="34"><label class="style9">Address</label></td> <td><input name="address" type="text" value="" /></td> </tr> <tr> <td height="36"><label class="style9">City</label></td> <td><input name="city" type="text" value="" width="250" /> <span style="font-size:13px" class="style10">Srilanka Only</span></td> </tr> <tr> <td height="62"><label class="style9">Description</label></td> <td><textarea name="description" cols="25" rows="5"></textarea></td> </tr> <tr> <td height="62"><label class="style9">Contact</label></td> <td><input name="contact" type="text" value="" width="250" /></td> </tr> <tr> <td height="118" colspan="2"> <input name="submit" type="submit" value="Submit"/> <input name="cancel" type="button" value="Cancel" /> </td> </tr> </table> </div></form> Edited March 20, 2013 by Spraban9 Quote Link to comment https://forums.phpfreaks.com/topic/275902-save-coding-not-working/ Share on other sites More sharing options...
PaulRyan Posted March 20, 2013 Share Posted March 20, 2013 You need to add the METHOD attribute to your form. So this: <form name="frmphoneads" id="frmphoneads" action="phoneadsup.php"> Becomes: <form method="POST" name="frmphoneads" id="frmphoneads" action="phoneadsup.php"> Quote Link to comment https://forums.phpfreaks.com/topic/275902-save-coding-not-working/#findComment-1419788 Share on other sites More sharing options...
Zane Posted March 20, 2013 Share Posted March 20, 2013 Instead of checking whether the variables are equal to nothing, you SHOULD be using PHP's isset function if ( isset($_POST['name'], $_POST['make'], $_POST['model'], $_POST['camera']) ) { $name = $_POST['name']; } Quote Link to comment https://forums.phpfreaks.com/topic/275902-save-coding-not-working/#findComment-1419795 Share on other sites More sharing options...
Jessica Posted March 20, 2013 Share Posted March 20, 2013 Posted variables will be set even if they're blank strings. Quote Link to comment https://forums.phpfreaks.com/topic/275902-save-coding-not-working/#findComment-1419796 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.